diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 5c8d3d44..fe0b4169 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -285,7 +285,7 @@ namespace Myshipping.Application .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID) .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE)) .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME)) - .WhereIF( input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID) + .WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID) .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER)) .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE == input.CUSTSERVICE) .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME == input.CUSTOMERNAME) @@ -323,12 +323,13 @@ namespace Myshipping.Application var list = entities.Adapt>(); - + var status = _repBookingStatus.AsQueryable(); + var remark = _bookingremark.AsQueryable(); foreach (var item in list.Items) { - var sta = await _repBookingStatus.AsQueryable().Where(x => x.BookingId == item.Id).ToListAsync(); + var sta = await status.Where(x => x.BookingId == item.Id).ToListAsync(); if (sta != null) { item.bookstatus = sta; } - var st = await _bookingremark.AsQueryable().Where(x => x.PId == item.Id).ToListAsync(); + var st = await remark.Where(x => x.PId == item.Id).ToListAsync(); if (st != null) { item.bookremark = st; } if (!string.IsNullOrWhiteSpace(item.ETD)) { @@ -3398,20 +3399,20 @@ namespace Myshipping.Application //优先取订舱的EDI附属信息,为空取FTP配置 primaryModel.EDIATTN = ediExtModel.EDIAttn; - if(string.IsNullOrWhiteSpace(primaryModel.EDIATTN)) + if (string.IsNullOrWhiteSpace(primaryModel.EDIATTN)) { primaryModel.EDIATTN = ftpSet.SENDATTN; } primaryModel.EDIATTNTEL = ediExtModel.EDIAttnTel; - if(string.IsNullOrWhiteSpace(primaryModel.EDIATTNTEL)) + if (string.IsNullOrWhiteSpace(primaryModel.EDIATTNTEL)) { primaryModel.EDIATTNTEL = ftpSet.SENDTEL; } primaryModel.EDIATTNEMAIL = ediExtModel.EDIAttnMail; - if(string.IsNullOrWhiteSpace(primaryModel.EDIATTNEMAIL)) + if (string.IsNullOrWhiteSpace(primaryModel.EDIATTNEMAIL)) { primaryModel.EDIATTNEMAIL = ftpSet.SENDEMAIL; } @@ -3541,7 +3542,7 @@ namespace Myshipping.Application bool isSendEmail = false; //是订舱并且FTP配置了订舱接收邮箱则触发邮箱发送 - if(ftpSet.SendType.Equals("SO",StringComparison.OrdinalIgnoreCase) + if (ftpSet.SendType.Equals("SO", StringComparison.OrdinalIgnoreCase) && model.sendType.Equals("B", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(ftpSet.RECEIVEEMAIL)) { @@ -3591,7 +3592,7 @@ namespace Myshipping.Application PId = logId, Field = String.Empty, OldValue = String.Empty, - NewValue = $"发送 {order.CARRIERID} EDI 类型={model.sendType} 通过{(isSendEmail?"邮件":"FTP")} {(sendStatus.succ ? "成功":"失败")}", + NewValue = $"发送 {order.CARRIERID} EDI 类型={model.sendType} 通过{(isSendEmail ? "邮件" : "FTP")} {(sendStatus.succ ? "成功" : "失败")}", }); if (!sendStatus.succ) @@ -3759,14 +3760,14 @@ namespace Myshipping.Application /// EDI配置 /// 返回回执 private async Task InnerSendBookingOrClosingEDIToEmail(BookingOrder bookingOrder, string filePath, - string sendType, string emailTopic,DjyEdiSetting ediCfg) + string sendType, string emailTopic, DjyEdiSetting ediCfg) { CommonWebApiResult result = new CommonWebApiResult { succ = true }; var emailUrl = _cache.GetAllDictData().GetAwaiter().GetResult() .FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "email_api_url")?.Value; - if(emailUrl == null) + if (emailUrl == null) throw Oops.Bah("字典未配置 url_set->email_api_url 请联系管理员"); List emailList = new List(); @@ -4575,8 +4576,51 @@ namespace Myshipping.Application + /// + /// 获取订舱数据接口 备注 、 文件 、日志、服务项目、状态日志 + /// + /// + [HttpGet("/BookingOrder/GetAllData")] + public async Task GetAllData(long bookingId) + { + BookingAllData allData = new BookingAllData(); + //服务项目 + var itemlist = await _serviceItem.AsQueryable().Where(x => x.BookingId == bookingId).ToListAsync(); + allData.item = itemlist; + var remarklist = await _bookingremark.AsQueryable().Where(u => u.PId == bookingId).ToListAsync(); + allData.remark = remarklist; + var filelist = await _bookingfile.AsQueryable().Filter(null, true).Where(u => u.BookingId == bookingId).ToListAsync(); + allData.file = filelist; + var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.OpTime).ToListAsync(); + var dto = statuslog.Adapt>(); + var statuslogdetail = _statuslogdetail.AsQueryable(); + foreach (var item in dto) + { + var detail =await statuslogdetail.Where(x => x.PId == item.Id).ToListAsync(); + item.detail = detail.Adapt>(); + } + allData.statuslog = dto; + var bookinglog = _bookinglog.AsQueryable(); + List list = new List(); + var main = await bookinglog.Where(u => u.BookingId == bookingId).ToListAsync(); + list = main.Adapt>(); + if (list != null) + { + var bookinglogdetail = _bookinglogdetail.AsQueryable(); + foreach (var item in list) + { + var details = await bookinglogdetail.Where(x => x.PId == item.Id).ToListAsync(); + item.details = details; + } + } + + allData.log = list; + + return allData; + + } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingAllData.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingAllData.cs new file mode 100644 index 00000000..ba6955b2 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingAllData.cs @@ -0,0 +1,24 @@ +using Myshipping.Application.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class BookingAllData + { + + public List item { get; set; } + + + public List remark { get; set; } + + + public List file { get; set; } + + public List statuslog { get; set; } + public List log { get; set; } + } +}