diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index c6afd39bd..781137787 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -111,10 +111,31 @@ public class DeliverRequestAppService : return dictionary; } - private async Task CheckSalePrice(List requests) + /// + /// 成品发运价格校验 + /// + /// + /// + /// + /// + [HttpPost("check-sale-price")] + public async Task> CheckSalePriceAsync(List 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 errors=new List(); - 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)