diff --git a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs index 0cc3d0bf..16744200 100644 --- a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs +++ b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs @@ -59,7 +59,7 @@ namespace Myshipping.Application.EDI { custContact = await repCustomer.AsQueryable() .InnerJoin((cust, contact) => cust.Id == contact.CustomerId) - .Where((cust, contact) => cust.CustSysId == custOrder.TenantId && contact.CustSysId == custOrder.BookingUserId) + .Where((cust, contact) => cust.CustSysId == custOrder.BookingTenantId && contact.CustSysId == custOrder.BookingUserId) .Select((cust, contact) => contact) .SingleAsync(); if (custContact == null) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index be6d3834..a50ef509 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -10478,6 +10478,33 @@ namespace Myshipping.Application } return true; } + + /// + /// 设置小票截止时间 + /// 拓展数据ID + /// 订舱ID + /// 截止时间 + /// + [HttpPost("/BookingOrder/SetTxxpEndTime")] + public async Task SetTxxpEndTime(long extId, long bookId, DateTime date) + { + BookingExtendState extModel = null; + if (extId > 0) + { + extModel = await _repextendstate.AsQueryable().FirstAsync(x => x.Id == extId); + extModel.TxxpEndTime = date; + await _repextendstate.UpdateAsync(extModel); + } + else + { + extModel = new BookingExtendState(); + extModel.Id = YitIdHelper.NextId(); + extModel.bookingId = bookId; + extModel.TxxpEndTime = date; + await _repextendstate.InsertAsync(extModel); + } + } + #endregion #region 临时测试使用 diff --git a/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs b/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs index 5cd010e6..7506d700 100644 --- a/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs +++ b/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs @@ -78,18 +78,18 @@ namespace Myshipping.Application.Service { BookingSoTemplate model = null; - //同一客户,同一船公司,只允许生效一个模板。 - if (input.IsEnable) + if (input.Id > 0) { - var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.CustName == input.CustName && x.CarrierId == input.CarrierId && x.IsEnable); - if (c > 0) + //同一用户,同一船公司,只允许生效一个模板。 + if (input.IsEnable) { - throw Oops.Bah($"客户:{input.CustName},船司:{input.Carrier} 已存在启用的模板"); + var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable && x.Id != input.Id); + if (c > 0) + { + throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); + } } - } - if (input.Id > 0) - { model = _rep.FirstOrDefault(x => x.Id == input.Id); input.Adapt(model); @@ -98,9 +98,14 @@ namespace Myshipping.Application.Service } else { - if (_rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.CustName == input.CustName && x.CarrierId == input.CarrierId) > 0) + //同一用户,同一船公司,只允许生效一个模板。 + if (input.IsEnable) { - throw Oops.Bah($"客户:{input.CustName},船司:{input.Carrier} 已创建过模板"); + var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable); + if (c > 0) + { + throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); + } } model = input.Adapt();