jianghaiqing 11 months ago
commit 5df190bfc3

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

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

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

Loading…
Cancel
Save