订舱发送校验

时间格式显示问题
master
wanghaomei 1 year ago
parent 3fe3341e11
commit 362ab5be5e

@ -0,0 +1,28 @@

using Mapster;
using Myshipping.Application.Entity;
namespace Myshipping.Application
{
public class Mapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType<BookingCustomerOrder, BookingCustomerOrderListOutput>()
.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<BookingCustomerOrder, BookingCustomerOrderSaveOutput>()
.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<BookingCustomerOrder, BookingCustomerSubmitReceiveDto>()
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : string.Empty);
}
}
}

@ -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<BookingCustomerSubmitReceiveDto>();

@ -123,7 +123,7 @@ namespace Myshipping.Application
/// <summary>
/// 开船日期
/// </summary>
public DateTime? ETD { get; set; }
public string ETD { get; set; }
/// <summary>
/// 合约号
/// </summary>

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

Loading…
Cancel
Save