jianghaiqing 7 months ago
commit b098313ee6

@ -59,7 +59,7 @@ namespace Myshipping.Application.EDI
{ {
custContact = await repCustomer.AsQueryable() custContact = await repCustomer.AsQueryable()
.InnerJoin<DjyCustomerContact>((cust, contact) => cust.Id == contact.CustomerId) .InnerJoin<DjyCustomerContact>((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) .Select((cust, contact) => contact)
.SingleAsync(); .SingleAsync();
if (custContact == null) if (custContact == null)

@ -10478,6 +10478,33 @@ namespace Myshipping.Application
} }
return true; return true;
} }
/// <summary>
/// 设置小票截止时间
/// <paramref name="extId"/>拓展数据ID
/// <paramref name="bookId"/>订舱ID
/// <paramref name="date"/>截止时间
/// <returns></returns>
[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 #endregion
#region 临时测试使用 #region 临时测试使用

@ -78,18 +78,18 @@ namespace Myshipping.Application.Service
{ {
BookingSoTemplate model = null; BookingSoTemplate model = null;
//同一客户,同一船公司,只允许生效一个模板。 if (input.Id > 0)
if (input.IsEnable)
{ {
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); model = _rep.FirstOrDefault(x => x.Id == input.Id);
input.Adapt(model); input.Adapt(model);
@ -98,9 +98,14 @@ namespace Myshipping.Application.Service
} }
else 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<BookingSoTemplate>(); model = input.Adapt<BookingSoTemplate>();

Loading…
Cancel
Save