wet 2 years ago
commit b958882030

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

@ -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 = "保存成功";

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

Loading…
Cancel
Save