|
|
@ -111,10 +111,31 @@ public class DeliverRequestAppService : |
|
|
|
|
|
|
|
return dictionary; |
|
|
|
} |
|
|
|
private async Task CheckSalePrice(List<DeliverRequest> requests) |
|
|
|
/// <summary>
|
|
|
|
/// 成品发运价格校验
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
/// <param name="truckNumber"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("check-sale-price")] |
|
|
|
public async Task<List<string>> CheckSalePriceAsync(List<Guid> ids, string truckNumber) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(truckNumber)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"车牌号不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
var entitys = await _repository.GetListAsync(r => ids.Contains(r.Id), true).ConfigureAwait(false); |
|
|
|
if (entitys.Select(r => r.CustomerCode).Distinct().Count() > 1) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); |
|
|
|
} |
|
|
|
//一车发运车牌号相同
|
|
|
|
entitys.ForEach(r => { r.MesTruckNumber = truckNumber; }); |
|
|
|
Check.NotNull(entitys, typeof(DeliverRequest).Name); |
|
|
|
List<string> errors=new List<string>(); |
|
|
|
foreach (var request in requests) |
|
|
|
foreach (var request in entitys) |
|
|
|
{ |
|
|
|
foreach (var itm in request.Details) |
|
|
|
{ |
|
|
@ -125,12 +146,7 @@ public class DeliverRequestAppService : |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"{string.Format(",",errors.ToArray())+"销售价格单里不存在价格!"}"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return errors; |
|
|
|
} |
|
|
|
|
|
|
|
private async Task CheckCustomerItem(DeliverRequest request) |
|
|
|