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",