From 362ab5be5e165bf21cd8e489c6ac9e22e5cebe6f Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Mon, 4 Sep 2023 11:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E8=88=B1=E5=8F=91=E9=80=81=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.sln => BookingDjy.sln | 0 Myshipping.Application/ConfigOption/Mapper.cs | 28 +++++++++++++ .../BookingCustomerOrderService.cs | 41 +++++++++++++++++++ .../Service/BookingCustomerOrder/Dto/Dtos.cs | 2 +- Myshipping.Web.Core/dbsettings.json | 3 +- 5 files changed, 72 insertions(+), 2 deletions(-) rename Myshipping.sln => BookingDjy.sln (100%) create mode 100644 Myshipping.Application/ConfigOption/Mapper.cs diff --git a/Myshipping.sln b/BookingDjy.sln similarity index 100% rename from Myshipping.sln rename to BookingDjy.sln diff --git a/Myshipping.Application/ConfigOption/Mapper.cs b/Myshipping.Application/ConfigOption/Mapper.cs new file mode 100644 index 0000000..62d09df --- /dev/null +++ b/Myshipping.Application/ConfigOption/Mapper.cs @@ -0,0 +1,28 @@ + + +using Mapster; +using Myshipping.Application.Entity; + +namespace Myshipping.Application +{ + public class Mapper : IRegister + { + public void Register(TypeAdapterConfig config) + { + config.ForType() + .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : string.Empty) + .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty) + .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty); + + config.ForType() + .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : string.Empty) + .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty) + .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty); + + config.ForType() + .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : string.Empty); + + + } + } +} \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 2a3d5ad..6808931 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -412,8 +412,49 @@ namespace Myshipping.Application //构建数据并发送 var orderList = _rep.AsQueryable().Where(x => ids.Contains(x.Id)).ToList(); + + //2023-9-1,衣国豪:点击发送订舱时,最少得填写船公司,船期,目的地,品名,箱型,箱量,重量,如果以上信息没填,允许保存,但是发送订舱时给出提示: XXX不能为空,请补充后重新发送 + var emptyCarrList = orderList.Where(x => string.IsNullOrEmpty(x.CARRIERID)).Select(x => x.BOOKINGNO).ToList(); + if (emptyCarrList.Any()) + { + throw Oops.Bah($"船公司不能为空:\r\n{string.Join("\r\n ", emptyCarrList)}\r\n请补充后重新发送"); + } + + var emptyETD = orderList.Where(x => !x.ETD.HasValue).Select(x => x.BOOKINGNO).ToList(); + if (emptyETD.Any()) + { + throw Oops.Bah($"船期不能为空:\r\n{string.Join("\r\n ", emptyETD)}\r\n请补充后重新发送"); + } + + var emptyDischarge = orderList.Where(x => string.IsNullOrEmpty(x.PORTDISCHARGEID)).Select(x => x.BOOKINGNO).ToList(); + if (emptyDischarge.Any()) + { + throw Oops.Bah($"目的地不能为空:\r\n{string.Join("\r\n ", emptyDischarge)}\r\n请补充后重新发送"); + } + + var emptyDescrip = orderList.Where(x => string.IsNullOrEmpty(x.DESCRIPTION)).Select(x => x.BOOKINGNO).ToList(); + if (emptyDescrip.Any()) + { + throw Oops.Bah($"品名不能为空:\r\n{string.Join("\r\n ", emptyDescrip)}\r\n请补充后重新发送"); + } + + var emptyKgs = orderList.Where(x => !x.KGS.HasValue).Select(x => x.BOOKINGNO).ToList(); + if (emptyKgs.Any()) + { + throw Oops.Bah($"重量不能为空:\r\n{string.Join("\r\n ", emptyKgs)}\r\n请补充后重新发送"); + } + var ordIdList = orderList.Select(o => o.Id).ToList(); var ctnList = _repCtn.AsQueryable().Where(x => ordIdList.Contains(x.BILLID.Value)).ToList(); + + //2023-9-1,衣国豪:点击发送订舱时,最少得填写船公司,船期,目的地,品名,箱型,箱量,重量,如果以上信息没填,允许保存,但是发送订舱时给出提示: XXX不能为空,请补充后重新发送 + var emptyCtn = ctnList.Where(x => string.IsNullOrEmpty(x.CTNALL) || !x.CTNNUM.HasValue).Select(x => x.BILLID).Distinct().ToList(); + if (emptyKgs.Any()) + { + var emptyCtnOrd = orderList.Where(x => emptyCtn.Contains(x.Id)).Select(x => x.BOOKINGNO).ToList(); + throw Oops.Bah($"箱型箱量不能为空:\r\n{string.Join("\r\n", emptyCtnOrd)}\r\n请补充后重新发送"); + } + var fileList = _repFile.AsQueryable().Where(x => ordIdList.Contains(x.BookingId)).ToList(); var serviceItemList = _repServiceItem.AsQueryable().Where(x => ordIdList.Contains(x.BookingId.Value)).ToList(); var sendList = new List(); diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 9c545a4..52e9361 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -123,7 +123,7 @@ namespace Myshipping.Application /// /// 开船日期 /// - public DateTime? ETD { get; set; } + public string ETD { get; set; } /// /// 合约号 /// diff --git a/Myshipping.Web.Core/dbsettings.json b/Myshipping.Web.Core/dbsettings.json index c607145..746796e 100644 --- a/Myshipping.Web.Core/dbsettings.json +++ b/Myshipping.Web.Core/dbsettings.json @@ -2,7 +2,8 @@ "ConnectionStrings": { "DefaultDbNumber": "0", "DefaultDbType": "MySql", - "DefaultDbString": "Data Source=60.209.125.238;Database=booking_hechuan_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", + "DefaultDbString": "Data Source=60.209.125.238;Database=booking_customer_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", + //"DefaultDbString": "Data Source=60.209.125.238;Database=booking_djy_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", "DbConfigs": [ { "DbNumber": "1",