修改派车

optimize
jianghaiqing 2 years ago
parent d7e38ea8f7
commit b7f54df148

@ -41,6 +41,11 @@ namespace Myshipping.Application
/// 取消派车
/// </summary>
[Description("取消派车")]
CancelDispatch
CancelDispatch,
/// <summary>
/// 派车回写详情
/// </summary>
[Description("派车回写详情")]
DispatchBackSave
}
}

@ -124,9 +124,10 @@ namespace Myshipping.Application
/// 保存内部方法
/// </summary>
/// <param name="info">派车信息</param>
/// <param name="isCallBack">是否回写</param>
/// <returns>返回派车Id</returns>
[SqlSugarUnitOfWork]
private async Task<long> InnerSave(BookingTruckDto info)
private async Task<long> InnerSave(BookingTruckDto info,bool isCallBack = false)
{
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();
@ -174,16 +175,26 @@ namespace Myshipping.Application
{
var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == entity.Id);
if(model == null)
if (model == null)
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.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
{
it.TenantId,
@ -1638,6 +1649,13 @@ namespace Myshipping.Application
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
@ -1667,7 +1685,7 @@ namespace Myshipping.Application
if(bookingTruckInfo.Status != BookingTruckStatus.SUBMITED.ToString())
throw Oops.Oh($"当前派车信息不是已提交状态不能接收回写", typeof(InvalidOperationException));
var id = await InnerSave(info);
var id = await InnerSave(info,true);
result.succ = true;
result.msg = "保存成功";

@ -867,6 +867,7 @@ namespace Myshipping.Application
await _taskTruckRepository.AsUpdateable(info).IgnoreColumns(it => new
{
it.TenantId,
it.TenantName,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName,
@ -875,6 +876,10 @@ namespace Myshipping.Application
it.TruckId,
it.TruckName,
it.TruckCode,
it.TruckFlowNo,
it.TaskNo,
it.TASK_ID,
it.BookingTruckId
}).ExecuteCommandAsync();
@ -884,6 +889,9 @@ namespace Myshipping.Application
if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<BookingTruckCtnDto>>();
if (info.BookingTruckId.HasValue)
model.Id = info.BookingTruckId.Value;
//更新完回写订舱的派车信息
var service = _namedServiceProvider.GetService(nameof(BookingTruckService));
var rlt = await service.TruckDispatchCompleteCallBack(model);
@ -960,6 +968,9 @@ namespace Myshipping.Application
it.TruckName,
it.TruckCode,
}).ExecuteCommandAsync();
result.succ = true;
result.msg = "取消成功";
}
catch (Exception ex)
{

Loading…
Cancel
Save