|
|
@ -124,9 +124,10 @@ namespace Myshipping.Application
|
|
|
|
/// 保存内部方法
|
|
|
|
/// 保存内部方法
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="info">派车信息</param>
|
|
|
|
/// <param name="info">派车信息</param>
|
|
|
|
|
|
|
|
/// <param name="isCallBack">是否回写</param>
|
|
|
|
/// <returns>返回派车Id</returns>
|
|
|
|
/// <returns>返回派车Id</returns>
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
private async Task<long> InnerSave(BookingTruckDto info)
|
|
|
|
private async Task<long> InnerSave(BookingTruckDto info,bool isCallBack = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BookingTruck entity = info.Adapt<BookingTruck>();
|
|
|
|
BookingTruck entity = info.Adapt<BookingTruck>();
|
|
|
|
|
|
|
|
|
|
|
@ -154,7 +155,7 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (entity.Id == 0)
|
|
|
|
if (entity.Id == 0 && !isCallBack)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entity.Status = BookingTruckStatus.TEMP.ToString();
|
|
|
|
entity.Status = BookingTruckStatus.TEMP.ToString();
|
|
|
|
|
|
|
|
|
|
|
@ -177,13 +178,23 @@ namespace Myshipping.Application
|
|
|
|
if (model == null)
|
|
|
|
if (model == null)
|
|
|
|
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
|
|
|
|
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isCallBack)
|
|
|
|
|
|
|
|
{
|
|
|
|
//校验
|
|
|
|
//校验
|
|
|
|
ValidateTruck(OperateTypeEnum.Save, new BookingTruck[] { model });
|
|
|
|
ValidateTruck(OperateTypeEnum.Save, new BookingTruck[] { model });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ValidateTruck(OperateTypeEnum.DispatchBackSave, new BookingTruck[] { model });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.Status = BookingTruckStatus.SEND_DISPATCH.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entity.UpdatedTime = DateTime.Now;
|
|
|
|
entity.UpdatedTime = DateTime.Now;
|
|
|
|
entity.UpdatedUserId = UserManager.UserId;
|
|
|
|
entity.UpdatedUserId = UserManager.UserId;
|
|
|
|
entity.UpdatedUserName = UserManager.Name;
|
|
|
|
entity.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.TenantId,
|
|
|
|
it.TenantId,
|
|
|
@ -1638,6 +1649,13 @@ namespace Myshipping.Application
|
|
|
|
throw Oops.Oh($"派车状态只有暂存、已撤销才能作废", typeof(InvalidOperationException));
|
|
|
|
throw Oops.Oh($"派车状态只有暂存、已撤销才能作废", typeof(InvalidOperationException));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(operateType == OperateTypeEnum.DispatchBackSave)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (entityArg.Any(a => a.Status != BookingTruckStatus.SUBMITED.ToString()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Oh($"派车状态只有已提交才能回写详情", typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
@ -1667,7 +1685,7 @@ namespace Myshipping.Application
|
|
|
|
if(bookingTruckInfo.Status != BookingTruckStatus.SUBMITED.ToString())
|
|
|
|
if(bookingTruckInfo.Status != BookingTruckStatus.SUBMITED.ToString())
|
|
|
|
throw Oops.Oh($"当前派车信息不是已提交状态不能接收回写", typeof(InvalidOperationException));
|
|
|
|
throw Oops.Oh($"当前派车信息不是已提交状态不能接收回写", typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
|
|
|
|
var id = await InnerSave(info);
|
|
|
|
var id = await InnerSave(info,true);
|
|
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
result.succ = true;
|
|
|
|
result.msg = "保存成功";
|
|
|
|
result.msg = "保存成功";
|
|
|
|