快递模块调整:合并下单接口和保存接口

optimize
zhangxiaofeng 11 months ago
parent fcef329e5b
commit 44a835269b

@ -165,6 +165,11 @@ namespace Myshipping.Application.Service.ExpressDelivery.Dto
public List<ExpressDeliveryFee> FeeList { get; set; }
/// <summary>
/// 保存的同时,是否下单快递
/// </summary>
public bool IsSending { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (SettleAccountsTypeCode == "2" && string.IsNullOrWhiteSpace(MonthlyCard))

@ -238,13 +238,21 @@ namespace Myshipping.Application
List<string> cancelMblnoList = oldMblnoList.Except(newMblnoList).ToList();
await InsertNewBookingStatusWithMblnoList(cancelMblnoList, STATUS_DISASSOCIATION);
// 先删除,再新增业务信息
await _businessRep.DeleteAsync(x => x.PId == entity.Id);
input.Business.ForEach(b => b.PId = entity.Id);
await _businessRep.InsertAsync(input.Business);
if (addMblnoList.Count != 0 || cancelMblnoList.Count != 0)
{
// 先删除,再新增业务信息
await _businessRep.DeleteAsync(x => x.PId == entity.Id);
input.Business.ForEach(b => b.PId = entity.Id);
await _businessRep.InsertAsync(input.Business);
}
}
}
#endregion
if (input.IsSending)
{
await SendBooking(entity);
}
}
return await Get(entity.Id);
}
@ -304,12 +312,10 @@ namespace Myshipping.Application
/// <summary>
/// 发送快递
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpPost("SendBooking")]
public async Task<dynamic> SendBooking(long Id)
/// [HttpPost("SendBooking")]
[NonAction]
public async Task<dynamic> SendBooking(ExpressDeliveryOrder order)
{
var order = _orderRep.FirstOrDefault(x => x.Id == Id);
if (order == null)
{
throw Oops.Bah("请选择正确数据!");
@ -322,6 +328,7 @@ namespace Myshipping.Application
{
throw Oops.Bah("下单失败,原因:重复下单");
}
var Id = order.Id;
IDeliverySend deliverySend = GetDeliverySend(order.KDCompany);
string waybillNo = await deliverySend.CreateOrder(order);

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.ExpressDelivery.Dto;
using Myshipping.Core;
using System.Collections.Generic;
@ -12,7 +13,7 @@ namespace Myshipping.Application
Task<SqlSugarPagedList<ExpressDeliveryDto>> Page([FromQuery] ExpressDeliveryInput input);
//Task<dynamic> QueryKDSchedule(long Id);
Task<ExpressDeliveryDto> Save(ExpressDeliveryDto input);
Task<dynamic> SendBooking(long Id);
Task<dynamic> SendBooking(ExpressDeliveryOrder order);
Task DeleteAddress(string ids);
Task<List<ExpressDeliveryAddressDto>> GetAddressList();
Task SaveOrUpdateAddress(ExpressDeliveryAddressDto input);

Loading…
Cancel
Save