diff --git a/Myshipping.Application/EDI/PILEdiHelper.cs b/Myshipping.Application/EDI/PILEdiHelper.cs index 9ece3325..80eb2168 100644 --- a/Myshipping.Application/EDI/PILEdiHelper.cs +++ b/Myshipping.Application/EDI/PILEdiHelper.cs @@ -1,5 +1,6 @@ using Myshipping.Application.EDI.ESL; using MySqlX.XDevAPI.Common; +using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; using System.IO; @@ -670,16 +671,25 @@ namespace Myshipping.Application.EDI.PIL var 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需要修改路径 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); StreamWriter r = new StreamWriter(f, Encoding.Default); 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("", 4);//5 //Filler//M//X(4)//19 //22 //Spaces - int iLs = InttrEdi.ForWarderName.Length / 35; - int iLs2 = InttrEdi.ForWarderName.Length % 35; + int iLs = (!string.IsNullOrWhiteSpace(InttrEdi.ForWarderName)?InttrEdi.ForWarderName.Length:0) / 35; + int iLs2 = (!string.IsNullOrWhiteSpace(InttrEdi.ForWarderName)?InttrEdi.ForWarderName.Length:0) % 35; int n = 0; for (int i = 0; i < iLs; i++) { @@ -1669,7 +1679,7 @@ namespace Myshipping.Application.EDI.PIL if (InttrEdi.filetype == "E") { //欧盟港口、伊朗港口、KHI - if (bill.cKHI != "") + if (!string.IsNullOrWhiteSpace(bill.cKHI)) { Shipping = bill.cKHI; List ShippingListLs = formatlengthStr(Shipping, 120); @@ -1684,7 +1694,7 @@ namespace Myshipping.Application.EDI.PIL } //南美东 - if (bill.cNCM != "") + if (!string.IsNullOrWhiteSpace(bill.cNCM)) { Shipping = bill.cNCM; List ShippingListLs = formatlengthStr(Shipping, 120); @@ -1699,7 +1709,7 @@ namespace Myshipping.Application.EDI.PIL } //巴西线的木质包装情况 - if (bill.wNCM != "") + if (!string.IsNullOrWhiteSpace(bill.wNCM)) { Shipping = bill.wNCM; List ShippingListLs = formatlengthStr(Shipping, 120); diff --git a/Myshipping.Application/EDI/TSLEdiHelper.cs b/Myshipping.Application/EDI/TSLEdiHelper.cs index 7a18b402..de6521e6 100644 --- a/Myshipping.Application/EDI/TSLEdiHelper.cs +++ b/Myshipping.Application/EDI/TSLEdiHelper.cs @@ -727,10 +727,10 @@ namespace Myshipping.Application.EDI.TSL if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) filename = filename.Replace("\\", "/"); - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); 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"; - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); diff --git a/Myshipping.Application/EDI/WYEdiHelper.cs b/Myshipping.Application/EDI/WYEdiHelper.cs index 7e7a095b..44326d7a 100644 --- a/Myshipping.Application/EDI/WYEdiHelper.cs +++ b/Myshipping.Application/EDI/WYEdiHelper.cs @@ -630,10 +630,10 @@ namespace Myshipping.Application.EDI.WY if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) filename = filename.Replace("\\", "/"); - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); var icount = 0; diff --git a/Myshipping.Application/EDI/YMLEdiHelper.cs b/Myshipping.Application/EDI/YMLEdiHelper.cs index fb8da775..fe9ea658 100644 --- a/Myshipping.Application/EDI/YMLEdiHelper.cs +++ b/Myshipping.Application/EDI/YMLEdiHelper.cs @@ -656,10 +656,10 @@ namespace Myshipping.Application.EDI.YML if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) filename = filename.Replace("\\", "/"); - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); 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"; - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //如果是部署linux需要修改路径 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + filename = filename.Replace("\\", "/"); + + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); diff --git a/Myshipping.Application/EDI/YTEdiHelper.cs b/Myshipping.Application/EDI/YTEdiHelper.cs index 7ff7817b..af50800d 100644 --- a/Myshipping.Application/EDI/YTEdiHelper.cs +++ b/Myshipping.Application/EDI/YTEdiHelper.cs @@ -645,10 +645,10 @@ namespace Myshipping.Application.EDI.YT if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) filename = filename.Replace("\\", "/"); - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); var icount = 0; diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index b1cf62d8..0ddd2b03 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -4463,7 +4463,7 @@ - + 批量保存关系人(同时新增、删除、修改) @@ -4797,6 +4797,13 @@ + + + 删除放舱 + + + + 放舱发送 @@ -4851,375 +4858,1127 @@ 打印类型代码,对应字典booking_template_type - + + + 下载打印文件(PDF直接预览) + + 查看ID + + + + + 获取订舱打印模板列表(带有当前用户打印历史排序) + + + + + + 发送下货纸 + + + + + + + 样单 + + + + + + + 保存(新增或修改)样单 + + + + + + + 获取样单pdf + + + + + + + 获取提箱小票链接 + + + + + + + 获取VGM、VGM SI链接 + + + + + + + 直发VGM(单票) + + + + + + + 批量编辑vgm + + 业务id 逗号拼接 + + + + + 批量保存vgm + + + + + + + 发送订舱、截单EDI + + 订舱、截单EDI请求 + 返回回执 + + + + 下载订舱、截单EDI + + 订单主键 + 订单号 + 是否使用货代代码 + 货代代码 + 文件功能 (9原始,1 更新,5 退舱 ) + 发送类型 B-订舱 E-截单 + + + + + 上传FTP + + EDI文件路径 + FTP配置 + 返回回执 + + + + 触发订舱 + + + + + + + + + 检查订舱、截单EDI订单信息 + + + + + + 根据船公司ID获取EDI的路由枚举 + + 船公司ID + 返回适用的路由枚举 + + + + 上传ocr文件 + + + + + + + 获取图片 + + 文件名称 + 缩放比例,默认为1.5 + + + + + 获取文字 + + 文件名称 + 缩放比例 + x坐标 + y坐标 + 宽度 + 高度 + + + + + 获取用户报表的json + + + + + + 生成报表文件 + + + 类型,对应字典中的【订舱打印模板类型】 + + + + + 获取场站数据 + + + + + + + + 记录或更新订舱状态 + + + + + + + + + 批量编辑 + + + + + 主键 + + + + + 船名 + + + + + 内部航次 + + + + + 开船日期 + + + + + 海关航次 + + + + + 卸货港代码 + + + + + 卸货港 + + + + + 目的地代码 + + + + + 目的地 + + + + + 截港日期 + + + + + 截单日期 + + + + + id + + + + + 提单号 + + + + + 箱id + + + + + 箱型代码 + + + + + 箱型 + + + + + 箱号 + + + + + 毛重 + + + + + 皮重 + + + + + 称重方式 + + + + + 称重重量 + + + + + 操作类型(新增,编辑) + + + + + 租户Id + + + + + 创建时间 + + + + + 创建者Id + + + + + 创建者名称 + + + + + 创建者名称 + + + + + 业务id + + + + + 备注 + + + + + 业务id + + + + + 状态 + + + + + 状态时间 + + + + + 类别 + + + + + 状态分类 + + + + + 提单号 + + + + + 主单id + + + + + 状态 + + + + + 箱号 + + + + + 状态时间 + + + + + 业务编号 + + + + + 业务状态 + + + + + 业务状态名称 + + + + + 业务日期 + + + + + 主提单号 + + + + + 分提单号 + + + + + 订舱编号 + + + + + 合约号 + + + + + 客户合同号 + + + + + 发货人代码 + + + + + 收货人代码 + + + + + 通知人代码 + + + + + 发货人 + + + + + 收货人 + + + + + 通知人 + + + + + 第二通知人 + + + + + 场站代码 + + + + + 场站 + + + + + 船舶呼号 + + + + + 船名 + + + + + 海关航次 + + + + + 内部航次 + + + + + 开船日期 + + + + + 实际开船日期 + + + + + 截港日期 + + + + + 截单日期 + + + + + 截VGM时间 + + + + + 预计到港日期 + + + + + 收货地代码 + + + + + 收货地 + + + + + 起运港代码 + + + + + 起运港 + + + + + 卸货港代码 + + + + + 卸货港 + + + + + 交货地代码 + + + + + 交货地 + + + + + 目的地代码 + + + + + 目的地 + + + + + 提单份数 + + + + + 副本提单份数 + + + + + 签单方式 + + + + + 签单日期 + + + + + 签单地点代码 + + + + + 签单地点 + + + + + 付费方式 + + + + + 预付地点 + + + + + 到付地点 + + + + + 运输条款 + + + + + 唛头 + + + + + HS代码 + + + + + 货描 + + + + + 件数 + + + + + 包装 + + + + + 毛重 + + + + + 尺码 + + + + + 件数大写 + + + + + 集装箱 + + + + + 船公司代号 + + + + + 船公司 + + + + + 货物标识 + + + + + 危险品类别 + + + + + 危险品编号 + + + + + 危险品页号 + + + + + 危险品标签 + + + + + 危险品联系人 + + + + + 温度单位 + + + + + 设置温度 + + + + + 通风度 + + + + + 湿度 + + + + + 最低温度 + + + + + 最高温度 + + + + + 是否SOC箱 + + + + + SO备注 + + + + + SI备注 + + + + + 场站备注 + + + + + 公司ID + + + + + 公司名称 + + + + + 发货人名称 + + + + + 发货人地址1 + + + + + 发货人地址2 + + + + + 发货人地址3 + + + + + 发货人城市 + + + + + 发货人省份代码 + + + + + 发货人邮编 + + + + + 发货人国家代码 + + + - 下载打印文件(PDF直接预览) + 发货人联系人 - 查看ID - - + - 获取订舱打印模板列表(带有当前用户打印历史排序) + 发货人电话 - - + - 发送下货纸 + 收货人名称 - - - + - 样单 + 收货人地址1 - - - + - 保存(新增或修改)样单 + 收货人地址2 - - - + - 获取样单pdf + 收货人地址3 - - - + - 获取提箱小票链接 + 收货人城市 - - - + - 获取VGM、VGM SI链接 + 收货人省份代码 - - - + - 直发VGM(单票) + 收货人邮编 - - - + - 批量编辑vgm + 收货人国家代码 - 业务id 逗号拼接 - - + - 批量保存vgm + 收货人联系人 - - - + - 发送订舱、截单EDI + 收货人电话 - 订舱、截单EDI请求 - 返回回执 - + - 上传FTP + 通知人名称 - EDI文件路径 - FTP配置 - 返回回执 - + - 触发订舱 + 通知人地址1 - - - - - + - 检查订舱、截单EDI订单信息 + 通知人地址2 - - + - 根据船公司ID获取EDI的路由枚举 + 通知人地址3 - 船公司ID - 返回适用的路由枚举 - + - 上传ocr文件 + 通知人城市 - - - + - 获取图片 + 通知人省份代码 - 文件名称 - 缩放比例,默认为1.5 - - + - 获取文字 + 通知人邮编 - 文件名称 - 缩放比例 - x坐标 - y坐标 - 宽度 - 高度 - - + - 获取用户报表的json + 通知人国家代码 - - + - 生成报表文件 + 通知人联系人 - - 类型,对应字典中的【订舱打印模板类型】 - - + - 获取场站数据 + 通知人电话 - - - - + - 记录或更新订舱状态 + PO号 - - - - - + - 批量编辑 + 操作id - + - 主键 + 单证id - + - 船名 + 操作 - + - 内部航次 + 单证 - + - 开船日期 + 销售ID - + - 海关航次 + 销售 - + - 卸货港代码 + 客服ID - + - 卸货港 + 客服 - + - 目的地代码 + 客户 - + - 目的地 + 订舱代理 - + - 截港日期 + 船代 - + - 截单日期 + 报关行 - + - id + 车队 - + - 提单号 + 国外代理 - + - 箱id + 客户ID - + - 箱型代码 + 订舱代理ID - + - 箱型 + 船代ID - + - 箱号 + 报关行ID - + - 毛重 + 车队ID - + - 皮重 + 国外代理名称 - + - 称重方式 + 委托方 - + - 称重重量 + 收货人DOOR地址 - + - 操作类型(新增,编辑) + 发货人DOOR地址 - + - 租户Id + SCAC代码 - + - 创建时间 + ITN编号 - + - 创建者Id + 预付地点ID - + - 创建者名称 + 到付地点ID - + - 创建者名称 + 客户系统编号 - + - 业务id + 中转港代码 - + - 备注 + 中转港 - + - 业务id + 第三付款地 - + - 状态 + 场站联系人 - + - 状态时间 + 场站联系人电话 - + - 类别 + 场站联系人邮箱 - + - 状态分类 + 费用自结 - + - 提单号 + 航线代码 - + - 主单id + 航线名称 - + - 状态 + 付款方 - + - 箱号 + 租户名称 - + - 状态时间 + 主单ID @@ -8073,7 +8832,7 @@ 船公司代号 - + 船公司 @@ -8553,7 +9312,7 @@ 是否拼箱 - + 卸货港国家代码 @@ -8568,6 +9327,21 @@ 卸货港国家中文 + + + 中转港国家代码 + + + + + 中转港国家英文 + + + + + 中转港国家中文 + + 箱信息 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 2c423946..5961d565 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -53,6 +53,7 @@ using System.Xml.Linq; using Myshipping.Application.Helper; using System.Net; using Furion.DistributedIDGenerator; +using System.Linq.Expressions; namespace Myshipping.Application { @@ -69,7 +70,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookinglogdetail; private readonly SqlSugarRepository _bookingremark; private readonly SqlSugarRepository _bookingfile; - private readonly SqlSugarRepository _dicdata; + private readonly SqlSugarRepository _repPrint; private readonly ILogger _logger; private readonly ISysCacheService _cache; @@ -112,7 +113,7 @@ namespace Myshipping.Application this._bookingremark = bookingremark; this._bookingfile = bookingfile; this._repPrint = repPrint; - this._dicdata = dicdata; + this._cache = cache; this._webAccountConfig = webAccountConfig; this._repStatuslog = statuslog; @@ -141,6 +142,7 @@ namespace Myshipping.Application public async Task Page([FromQuery] BookingOrderInput input) { List userlist = await DataFilterExtensions.GetDataScopeIdList(); + 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.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.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER)) .Where(u => userlist.Contains((long)u.CreatedUserId)) + .OrderBy(PageInputOrder.OrderBuilder(input.SortField,input.descSort)) .ToPagedListAsync(input.PageNo, input.PageSize); - return entities.XnPagedResult(); - } + var list = entities.Adapt>(); + + 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")] public async Task AddOrUpdate(BookingOrderDto Dto) { @@ -844,7 +856,7 @@ namespace Myshipping.Application [NonAction] 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; 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.Gid = UserManager.DjyUserId; 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(); - _logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString()); + _logger.LogInformation("调用运踪接口提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString()); } /// @@ -882,16 +895,17 @@ namespace Myshipping.Application [HttpPost("/BookingOrder/AddBookingStatusLog")] public async Task AddBookingStatusLog(List 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) { - //清空原有数据 - 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(); bookingStatusLog.BookingId = item.BookingId; @@ -901,7 +915,99 @@ namespace Myshipping.Application bookingStatusLog.OpTime = item.OpTime; bookingStatusLog.MBLNO = item.MBLNO; await _repStatuslog.InsertAsync(bookingStatusLog); - //var list=_repBookingStatus.AsQueryable().InnerJoin>((d,t)=>d.StaCode==t.C) + var list = await _repBookingStatus.AsQueryable().InnerJoin((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) { foreach (var dt in item.detail) @@ -912,16 +1018,8 @@ namespace Myshipping.Application BookingStatusLogDetail.CNTRNO = dt.CNTRNO; BookingStatusLogDetail.OPTime = dt.OPTime; await _statuslogdetail.InsertAsync(BookingStatusLogDetail); - if (dt.Status == "舱单") - { - - - - - - } - } + } } @@ -1011,6 +1109,23 @@ namespace Myshipping.Application } } + + + /// + /// 删除放舱 + /// + /// + /// + [SqlSugarUnitOfWork] + [HttpPost("/BookingLetteryard/LetterYardDelete")] + public async Task LetterYardDelete(long Id) + { + await _repLetterYard.DeleteAsync(x => x.BookingId == Id); + _logger.LogInformation(Id + "放舱删除成功!"); + } + + + /// /// 放舱发送 /// @@ -1280,8 +1395,17 @@ namespace Myshipping.Application { 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 opt = App.GetOptions().Path; var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径 @@ -2061,6 +2185,12 @@ namespace Myshipping.Application /// 返回回执 [HttpPost("/BookingOrder/SendBookingOrClosingEDI")] public async Task SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) + { + return await InnerBookingOrClosingEDI(model); + } + #endregion + + public async Task InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) { string batchNo = IDGen.NextID().ToString(); @@ -2122,8 +2252,6 @@ namespace Myshipping.Application throw Oops.Bah($"CARRIERID={order.CARRIERID} 发送SO(SI)的船公司EDI代码未找到"); - - var ediModel = new EDIBaseModel(); var ftpSet = _cache.GetAllEdiSetting().GetAwaiter().GetResult() @@ -2144,10 +2272,28 @@ namespace Myshipping.Application //读取文件配置 var fileCfg = App.GetOptions(); - 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().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)) + { + relativePath = relativePath.Replace("\\", "/"); filePath = filePath.Replace("\\", "/"); + } + _logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription); //预先创建目录 @@ -2286,6 +2432,20 @@ namespace Myshipping.Application 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()); DateTime bDate = DateTime.Now; @@ -2308,6 +2468,57 @@ namespace Myshipping.Application 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 + /// + /// 下载订舱、截单EDI + /// + /// 订单主键 + /// 订单号 + /// 是否使用货代代码 + /// 货代代码 + /// 文件功能 (9原始,1 更新,5 退舱 ) + /// 发送类型 B-订舱 E-截单 + /// + [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 #region 上传FTP @@ -2424,12 +2635,6 @@ namespace Myshipping.Application result.succ = currRlt.succ; result.extra = currRlt.succ ? currRlt.extra.ToString() : ""; - - //鐩存帴鍙戦€佹姤鏂囧埌FTP鏈嶅姟鍣? - if (model.send) - { - - } } else if (ediRouteEnum == EDIRouteEnum.WY) { diff --git a/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs new file mode 100644 index 00000000..1f36953a --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs @@ -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 + { + /// + /// 业务编号 + /// + //[Description("业务编号")] + public string BSNO { get; set; } + /// + /// 业务状态 + /// + //[Description("业务状态")] + public string BSSTATUS { get; set; } + /// + /// 业务状态名称 + /// + //[Description("业务状态名称")] + public string BSSTATUSNAME { get; set; } + /// + /// 业务日期 + /// + //[Description("业务日期")] + public DateTime? BSDATE { get; set; } + /// + /// 主提单号 + /// + [Description("主提单号")] + public string MBLNO { get; set; } + /// + /// 分提单号 + /// + [Description("分提单号")] + public string HBLNO { get; set; } + /// + /// 订舱编号 + /// + [Description("订舱编号")] + public string BOOKINGNO { get; set; } + /// + /// 合约号 + /// + [Description("合约号")] + public string CONTRACTNO { get; set; } + /// + /// 客户合同号 + /// + [Description("客户合同号")] + public string SERVICECONTRACTNO { get; set; } + /// + /// 发货人代码 + /// + //[Description("发货人代码")] + public string SHIPPERID { get; set; } + /// + /// 收货人代码 + /// + //[Description("收货人代码")] + public string CONSIGNEEID { get; set; } + /// + /// 通知人代码 + /// + //[Description("通知人代码")] + public string NOTIFYPARTYID { get; set; } + /// + /// 发货人 + /// + [Description("发货人")] + public string SHIPPER { get; set; } + /// + /// 收货人 + /// + [Description("收货人")] + public string CONSIGNEE { get; set; } + /// + /// 通知人 + /// + [Description("通知人")] + public string NOTIFYPARTY { get; set; } + /// + /// 第二通知人 + /// + [Description("第二通知人")] + public string NOTIFYPARTY2 { get; set; } + /// + /// 场站代码 + /// + //[Description("场站代码")] + public string YARDID { get; set; } + /// + /// 场站 + /// + [Description("场站")] + public string YARD { get; set; } + /// + /// 船舶呼号 + /// + [Description("船舶呼号")] + public string VESSELID { get; set; } + /// + /// 船名 + /// + [Description("船名")] + public string VESSEL { get; set; } + /// + /// 海关航次 + /// + [Description("海关航次")] + public string VOYNO { get; set; } + /// + /// 内部航次 + /// + [Description("内部航次")] + public string VOYNOINNER { get; set; } + /// + /// 开船日期 + /// + [Description("开船日期")] + public DateTime? ETD { get; set; } + /// + /// 实际开船日期 + /// + [Description("实际开船日期")] + public DateTime? ATD { get; set; } + /// + /// 截港日期 + /// + [Description("截港日期")] + public DateTime? CLOSINGDATE { get; set; } + /// + /// 截单日期 + /// + [Description("截单日期")] + public DateTime? CLOSEDOCDATE { get; set; } + /// + /// 截VGM时间 + /// + [Description("截VGM时间")] + public DateTime? CLOSEVGMDATE { get; set; } + /// + /// 预计到港日期 + /// + [Description("预计到港日期")] + public DateTime? ETA { get; set; } + /// + /// 收货地代码 + /// + //[Description("收货地代码")] + public string PLACERECEIPTID { get; set; } + /// + /// 收货地 + /// + [Description("收货地")] + public string PLACERECEIPT { get; set; } + /// + /// 起运港代码 + /// + [Description("起运港代码")] + public string PORTLOADID { get; set; } + /// + /// 起运港 + /// + [Description("起运港")] + public string PORTLOAD { get; set; } + /// + /// 卸货港代码 + /// + [Description("卸货港代码")] + public string PORTDISCHARGEID { get; set; } + /// + /// 卸货港 + /// + [Description("卸货港")] + public string PORTDISCHARGE { get; set; } + /// + /// 交货地代码 + /// + [Description("交货地代码")] + public string PLACEDELIVERYID { get; set; } + /// + /// 交货地 + /// + [Description("交货地")] + public string PLACEDELIVERY { get; set; } + /// + /// 目的地代码 + /// + [Description("目的地代码")] + public string DESTINATIONID { get; set; } + /// + /// 目的地 + /// + [Description("目的地")] + public string DESTINATION { get; set; } + /// + /// 提单份数 + /// + [Description("提单份数")] + public string NOBILL { get; set; } + /// + /// 副本提单份数 + /// + [Description("副本提单份数")] + public string COPYNOBILL { get; set; } + /// + /// 签单方式 + /// + [Description("签单方式")] + public string ISSUETYPE { get; set; } + /// + /// 签单日期 + /// + [Description("签单日期")] + public DateTime? ISSUEDATE { get; set; } + /// + /// 签单地点代码 + /// + [Description("签单地点代码")] + public string ISSUEPLACEID { get; set; } + /// + /// 签单地点 + /// + [Description("签单地点")] + public string ISSUEPLACE { get; set; } + /// + /// 付费方式 + /// + [Description("付费方式")] + public string BLFRT { get; set; } + /// + /// 预付地点 + /// + [Description("预付地点")] + public string PREPARDAT { get; set; } + /// + /// 到付地点 + /// + [Description("到付地点")] + public string PAYABLEAT { get; set; } + /// + /// 运输条款 + /// + [Description("运输条款")] + public string SERVICE { get; set; } + /// + /// 唛头 + /// + [Description("唛头")] + public string MARKS { get; set; } + /// + /// HS代码 + /// + [Description("HS代码")] + public string HSCODE { get; set; } + /// + /// 货描 + /// + [Description("货描")] + public string DESCRIPTION { get; set; } + /// + /// 件数 + /// + [Description("件数")] + public int? PKGS { get; set; } + /// + /// 包装 + /// + [Description("包装")] + public string KINDPKGS { get; set; } + /// + /// 毛重 + /// + [Description("毛重")] + public decimal? KGS { get; set; } + /// + /// 尺码 + /// + [Description("尺码")] + public decimal? CBM { get; set; } + /// + /// 件数大写 + /// + [Description("件数大写")] + public string TOTALNO { get; set; } + /// + /// 集装箱 + /// + [Description("集装箱")] + public string CNTRTOTAL { get; set; } + /// + /// 船公司代号 + /// + [Description("船公司代号")] + public string CARRIERID { get; set; } + /// + /// 船公司 + /// + [Description("船公司")] + public string CARRIER { get; set; } + /// + /// 货物标识 + /// + [Description("货物标识")] + public string CARGOID { get; set; } + /// + /// 危险品类别 + /// + [Description("危险品类别")] + public string DCLASS { get; set; } + /// + /// 危险品编号 + /// + [Description("危险品编号")] + public string DUNNO { get; set; } + /// + /// 危险品页号 + /// + [Description("危险品页号")] + public string DPAGE { get; set; } + /// + /// 危险品标签 + /// + [Description("危险品标签")] + public string DLABEL { get; set; } + /// + /// 危险品联系人 + /// + [Description("危险品联系人")] + public string LINKMAN { get; set; } + /// + /// 温度单位 + /// + [Description("温度单位")] + public string TEMPID { get; set; } + /// + /// 设置温度 + /// + [Description("设置温度")] + public string TEMPSET { get; set; } + /// + /// 通风度 + /// + [Description("通风度")] + public string REEFERF { get; set; } + /// + /// 湿度 + /// + [Description("湿度")] + public string HUMIDITY { get; set; } + /// + /// 最低温度 + /// + [Description("最低温度")] + public string TEMPMIN { get; set; } + /// + /// 最高温度 + /// + [Description("最高温度")] + public string TEMPMAX { get; set; } + /// + /// 是否SOC箱 + /// + [Description("是否SOC箱")] + public bool? ISCONTAINERSOC { get; set; } + /// + /// SO备注 + /// + [Description("SO备注")] + public string SOREMARK { get; set; } + /// + /// SI备注 + /// + [Description("SI备注")] + public string SIREMARK { get; set; } + /// + /// 场站备注 + /// + [Description("场站备注")] + public string YARDREMARK { get; set; } + /// + /// 公司ID + /// + //[Description("公司ID")] + public string COMPID { get; set; } + /// + /// 公司名称 + /// + [Description("公司名称")] + public string COMPNAME { get; set; } + /// + /// 发货人名称 + /// + [Description("发货人名称")] + public string SHIPPERNAME { get; set; } + /// + /// 发货人地址1 + /// + [Description("发货人地址1")] + public string SHIPPERADDR1 { get; set; } + /// + /// 发货人地址2 + /// + [Description("发货人地址2")] + public string SHIPPERADDR2 { get; set; } + /// + /// 发货人地址3 + /// + [Description("发货人地址3")] + public string SHIPPERADDR3 { get; set; } + /// + /// 发货人城市 + /// + [Description("发货人城市")] + public string SHIPPERCITY { get; set; } + /// + /// 发货人省份代码 + /// + [Description("发货人省份代码")] + public string SHIPPERPROVINCE { get; set; } + /// + /// 发货人邮编 + /// + [Description("发货人邮编")] + public string SHIPPERPOSTCODE { get; set; } + /// + /// 发货人国家代码 + /// + [Description("发货人国家代码")] + public string SHIPPERCOUNTRY { get; set; } + /// + /// 发货人联系人 + /// + [Description("发货人联系人")] + public string SHIPPERATTN { get; set; } + /// + /// 发货人电话 + /// + [Description("发货人电话")] + public string SHIPPERTEL { get; set; } + /// + /// 收货人名称 + /// + [Description("收货人名称")] + public string CONSIGNEENAME { get; set; } + /// + /// 收货人地址1 + /// + [Description("收货人地址1")] + public string CONSIGNEEADDR1 { get; set; } + /// + /// 收货人地址2 + /// + [Description("收货人地址2")] + public string CONSIGNEEADDR2 { get; set; } + /// + /// 收货人地址3 + /// + [Description("收货人地址3")] + public string CONSIGNEEADDR3 { get; set; } + /// + /// 收货人城市 + /// + [Description("收货人城市")] + public string CONSIGNEECITY { get; set; } + /// + /// 收货人省份代码 + /// + [Description("收货人省份代码")] + public string CONSIGNEEPROVINCE { get; set; } + /// + /// 收货人邮编 + /// + [Description("收货人邮编")] + public string CONSIGNEEPOSTCODE { get; set; } + /// + /// 收货人国家代码 + /// + [Description("收货人国家代码")] + public string CONSIGNEERCOUNTRY { get; set; } + /// + /// 收货人联系人 + /// + [Description("收货人联系人")] + public string CONSIGNEEATTN { get; set; } + /// + /// 收货人电话 + /// + [Description("收货人电话")] + public string CONSIGNEETEL { get; set; } + /// + /// 通知人名称 + /// + [Description("通知人名称")] + public string NOTIFYPARTYNAME { get; set; } + /// + /// 通知人地址1 + /// + [Description("通知人地址1")] + public string NOTIFYPARTYADDR1 { get; set; } + /// + /// 通知人地址2 + /// + [Description("通知人地址2")] + public string NOTIFYPARTYADDR2 { get; set; } + /// + /// 通知人地址3 + /// + [Description("通知人地址3")] + public string NOTIFYPARTYADDR3 { get; set; } + /// + /// 通知人城市 + /// + [Description("通知人城市")] + public string NOTIFYPARTYCITY { get; set; } + /// + /// 通知人省份代码 + /// + [Description("通知人省份代码")] + public string NOTIFYPARTYPROVINCE { get; set; } + /// + /// 通知人邮编 + /// + [Description("通知人邮编")] + public string NOTIFYPARTYPOSTCODE { get; set; } + /// + /// 通知人国家代码 + /// + [Description("通知人国家代码")] + public string NOTIFYPARTYCOUNTRY { get; set; } + /// + /// 通知人联系人 + /// + [Description("通知人联系人")] + public string NOTIFYPARTYATTN { get; set; } + /// + /// 通知人电话 + /// + [Description("通知人电话")] + public string NOTIFYPARTYTEL { get; set; } + /// + /// PO号 + /// + [Description("PO号")] + public string PONO { get; set; } + /// + /// 操作id + /// + [Description("操作id")] + public string OPID { get; set; } + /// + /// 单证id + /// + [Description("单证id")] + public string DOCID { get; set; } + /// + /// 操作 + /// + [Description("操作")] + public string OP { get; set; } + /// + /// 单证 + /// + //[Description("单证")] + public string DOC { get; set; } + /// + /// 销售ID + /// + //[Description("销售ID")] + public string SALEID { get; set; } + /// + /// 销售 + /// + [Description("销售")] + public string SALE { get; set; } + /// + /// 客服ID + /// + //[Description("客服ID")] + public string CUSTSERVICEID { get; set; } + /// + /// 客服 + /// + [Description("客服")] + public string CUSTSERVICE { get; set; } + /// + /// 客户 + /// + [Description("客户")] + public string CUSTOMERNAME { get; set; } + /// + /// 订舱代理 + /// + [Description("订舱代理")] + public string FORWARDER { get; set; } + /// + /// 船代 + /// + [Description("船代")] + public string SHIPAGENCY { get; set; } + /// + /// 报关行 + /// + [Description("报关行")] + public string CUSTOMSER { get; set; } + /// + /// 车队 + /// + [Description("车队")] + public string TRUCKER { get; set; } + /// + /// 国外代理 + /// + [Description("国外代理")] + public string AGENTID { get; set; } + /// + /// 客户ID + /// + //[Description("客户ID")] + public long? CUSTOMERID { get; set; } + /// + /// 订舱代理ID + /// + [Description("订舱代理ID")] + public string FORWARDERID { get; set; } + /// + /// 船代ID + /// + //[Description("船代ID")] + public string SHIPAGENCYID { get; set; } + /// + /// 报关行ID + /// + [Description("报关行ID")] + public string CUSTOMSERID { get; set; } + /// + /// 车队ID + /// + //[Description("车队ID")] + public string TRUCKERID { get; set; } + /// + /// 国外代理名称 + /// + [Description("国外代理名称")] + public string AGENTNAME { get; set; } + /// + /// 委托方 + /// + [Description("委托方")] + public string WEITUO { get; set; } + /// + /// 收货人DOOR地址 + /// + [Description("收货人DOOR地址")] + public string CONSIGNEEDOORADDR { get; set; } + /// + /// 发货人DOOR地址 + /// + [Description("发货人DOOR地址")] + public string SHIPPERDOORADDR { get; set; } + /// + /// SCAC代码 + /// + [Description("SCAC代码")] + public string SCACCODE { get; set; } + /// + /// ITN编号 + /// + [Description("ITN编号")] + public string ITNCODE { get; set; } + /// + /// 预付地点ID + /// + //[Description("预付地点ID")] + public string PREPARDATID { get; set; } + /// + /// 到付地点ID + /// + //[Description("到付地点ID")] + public string PAYABLEATID { get; set; } + /// + /// 客户系统编号 + /// + [Description("客户系统编号")] + public string CUSTNO { get; set; } + /// + /// 中转港代码 + /// + [Description("中转港代码")] + public string TRANSPORTID { get; set; } + /// + /// 中转港 + /// + [Description("中转港")] + public string TRANSPORT { get; set; } + /// + /// 第三付款地 + /// + [Description("第三付款地")] + public string THIRDPAYADDR { get; set; } + /// + /// 场站联系人 + /// + [Description("场站联系人")] + public string YARDCONTRACT { get; set; } + /// + /// 场站联系人电话 + /// + [Description("场站联系人电话")] + public string YARDCONTRACTTEL { get; set; } + /// + /// 场站联系人邮箱 + /// + [Description("场站联系人邮箱")] + public string YARDCONTRACTEMAIL { get; set; } + /// + /// 费用自结 + /// + [Description("费用自结")] + public bool? FEESELF { get; set; } + /// + /// 航线代码 + /// + [Description("航线代码")] + public string LANECODE { get; set; } + /// + /// 航线名称 + /// + [Description("航线名称")] + public string LANENAME { get; set; } + /// + /// 付款方 + /// + [Description("付款方")] + public string FREIGHTPAYER { get; set; } + /// + /// 租户名称 + /// + //[Description("租户名称")] + public string TenantName { get; set; } + /// + /// 主单ID + /// + //[Description("主单ID")] + public long? ParentId { get; set; } + + + + public List bookstatus { get; set; } + } +} diff --git a/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs b/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs index 8b03ea43..4cadd0fc 100644 --- a/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs +++ b/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Myshipping.Application.Entity; using Microsoft.Extensions.Logging; using System.Collections.Generic; +using Furion.FriendlyException; namespace Myshipping.Application { @@ -109,14 +110,16 @@ namespace Myshipping.Application /// /// [HttpPost("/BookingOrderContact/savebatch"), SqlSugarUnitOfWork] - public async Task SaveBatch(List input) + public async Task SaveBatch(List input,long bookingId) { - var bookingId = input.First().BookingId; _rep.Delete(x => x.BookingId == bookingId); - foreach (var item in input) - { - await _rep.InsertAsync(item.Adapt()); + if (input!=null&&input.Count>0) { + foreach (var item in input) + { + await _rep.InsertAsync(item.Adapt()); + } } + } ///// diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs index 95714fb3..7d04a75f 100644 --- a/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs @@ -67,7 +67,7 @@ namespace Myshipping.Application .Map(dest => dest.TotalNO, src => src.TOTALNO) .Map(dest => dest.CntrTotal, src => src.CNTRTOTAL) .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.DClass, src => src.DCLASS) .Map(dest => dest.DUnno, src => src.DUNNO) @@ -204,7 +204,7 @@ namespace Myshipping.Application .Map(dest => dest.TotalNO, src => src.TOTALNO) .Map(dest => dest.CntrTotal, src => src.CNTRTOTAL) .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.DClass, src => src.DCLASS) .Map(dest => dest.DUnno, src => src.DUNNO) diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs index e3466ae6..e8e64a20 100644 --- a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs @@ -251,7 +251,7 @@ namespace Myshipping.Application /// /// 船公司 /// - public string Carrirer { get; set; } + public string Carrier { get; set; } /// /// 货物标识 /// @@ -645,7 +645,7 @@ namespace Myshipping.Application /// /// 卸货港国家代码 /// - public string PortDischargeNo { get; set; } + public string PortDischargeCountryNo { get; set; } /// /// 卸货港国家英文 @@ -657,6 +657,21 @@ namespace Myshipping.Application /// public string PortDischargeCN { get; set; } + /// + /// 中转港国家代码 + /// + public string TransportCountryNo { get; set; } + + /// + /// 中转港国家英文 + /// + public string TransportEN { get; set; } + + /// + /// 中转港国家中文 + /// + public string TransportCN { get; set; } + /// /// 箱信息 /// diff --git a/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs b/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs index 059eab05..38d0901d 100644 --- a/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs +++ b/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs @@ -297,6 +297,8 @@ namespace Myshipping.Application msgModel.Main.BusinessInfo = mainInfo; + List codePortList = new List(); + //根据卸货港翻译航线信息 if (!string.IsNullOrWhiteSpace(mainInfo.PortDischargeId)) { @@ -320,25 +322,53 @@ namespace Myshipping.Application 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)); 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)); if (countryInfo == null || string.IsNullOrWhiteSpace(portInfo.EnName)) 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.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)) { diff --git a/Myshipping.Application/applicationsettings.json b/Myshipping.Application/applicationsettings.json index 9ace34ed..ec84f6de 100644 --- a/Myshipping.Application/applicationsettings.json +++ b/Myshipping.Application/applicationsettings.json @@ -9,6 +9,6 @@ "BookingAttach": { "basePath": "", //基础路径,不配置则使用当前系统目录 "relativePath": "BookingAttach", - "fileType": [ ".xls", ".xlsx", ".pdf" ] + "fileType": [ ".xls", ".xlsx", ".pdf", ".txt", ".pms" ] } } \ No newline at end of file diff --git a/Myshipping.Core/Extension/InputBase.cs b/Myshipping.Core/Extension/InputBase.cs index 31fc6cec..a1963e46 100644 --- a/Myshipping.Core/Extension/InputBase.cs +++ b/Myshipping.Core/Extension/InputBase.cs @@ -59,12 +59,9 @@ public class PageInputBase public virtual string SortField { get; set; } /// - /// 排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend) + /// 排序方法,默认降序 /// - public virtual string SortOrder { get; set; } + public virtual bool descSort { get; set; } = true; - /// - /// 降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样) - /// - public virtual string DescStr { get; set; } = "descend"; + } diff --git a/Myshipping.Core/Extension/PageInputOrder.cs b/Myshipping.Core/Extension/PageInputOrder.cs index 219c2e29..ac41209b 100644 --- a/Myshipping.Core/Extension/PageInputOrder.cs +++ b/Myshipping.Core/Extension/PageInputOrder.cs @@ -8,18 +8,16 @@ public class PageInputOrder /// /// 排序方式(默认降序) /// - /// - /// 是否降序 /// - public static string OrderBuilder(PageInputBase pageInput, bool descSort = true) + public static string OrderBuilder(string SortField,bool descSort = true) { // 约定默认每张表都有Id排序 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; } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 00494c25..69d8177a 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -5087,14 +5087,9 @@ 排序字段 - + - 排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend) - - - - - 降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样) + 排序方法,默认降序 @@ -5172,12 +5167,10 @@ 通用输入帮助类 - + 排序方式(默认降序) - - 是否降序 diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index e6d6725a..29de8786 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -1081,10 +1081,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie List list = await _sysCacheService.GetAllCodeLane(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), - x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) + x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.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 { + 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.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; @@ -1148,11 +1156,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie //{ // throw Oops.Bah("参数过多,请传入模块查询"); //} - var queryList = list.Where(x => x.Module == input.Module) - .WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase)) - .WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase)) - .WhereIF(!string.IsNullOrEmpty(input.PortCode), x => x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase)) - .WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase)); + var queryList = list + .WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Equals(input.LaneCode, 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.CarrierCode), x => !string.IsNullOrWhiteSpace(x.CarrierCode) && x.CarrierCode.Contains(input.CarrierCode, 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(); } #endregion @@ -1177,7 +1186,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie 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) throw Oops.Bah(ErrorCode.D1006); @@ -1194,7 +1203,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie } 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) throw Oops.Bah(ErrorCode.D1006); @@ -1221,11 +1230,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie List list = await _sysCacheService.GetAllCodeCountry(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), - x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) - || x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) + x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.Capital) && x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) + || (!string.IsNullOrWhiteSpace(x.Continent) && x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) ); return queryList.ToList();