|
|
|
@ -65,71 +65,84 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
BookingTruck entity = info.Adapt<BookingTruck>();
|
|
|
|
|
var id = InnerSave(info);
|
|
|
|
|
|
|
|
|
|
if(entity == null)
|
|
|
|
|
throw Oops.Oh($"派车信息不能为空");
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "保存成功";
|
|
|
|
|
result.ext = id;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"保存派车异常,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<BookingTruckCtn> entityCtnList = info.ContaList.Adapt<List<BookingTruckCtn>>();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (entity.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
_bookingTruckRepository.Insert(entity);
|
|
|
|
|
|
|
|
|
|
if (entityCtnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
entityCtnList.ForEach(async ctn =>
|
|
|
|
|
{
|
|
|
|
|
ctn.TruckId = entity.Id;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存内部方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info">派车信息</param>
|
|
|
|
|
/// <returns>返回派车Id</returns>
|
|
|
|
|
private async Task<long> InnerSave(BookingTruckDto info)
|
|
|
|
|
{
|
|
|
|
|
BookingTruck entity = info.Adapt<BookingTruck>();
|
|
|
|
|
|
|
|
|
|
await _bookingTruckContaRepository.InsertAsync(ctn);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (entity == null)
|
|
|
|
|
throw Oops.Oh($"派车信息不能为空");
|
|
|
|
|
|
|
|
|
|
List<BookingTruckCtn> entityCtnList = info.ContaList.Adapt<List<BookingTruckCtn>>();
|
|
|
|
|
|
|
|
|
|
if (entity.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
_bookingTruckRepository.Insert(entity);
|
|
|
|
|
|
|
|
|
|
if (entityCtnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
it.BookingId,
|
|
|
|
|
it.TruckId,
|
|
|
|
|
it.TruckName,
|
|
|
|
|
it.TruckCode,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
if (entityCtnList.Count > 0)
|
|
|
|
|
entityCtnList.ForEach(async ctn =>
|
|
|
|
|
{
|
|
|
|
|
entityCtnList.ForEach(async ctn =>
|
|
|
|
|
{
|
|
|
|
|
ctn.TruckId = entity.Id;
|
|
|
|
|
ctn.TruckId = entity.Id;
|
|
|
|
|
|
|
|
|
|
await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
await _bookingTruckContaRepository.InsertAsync(ctn);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "保存成功";
|
|
|
|
|
result.ext = entity.Id;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"保存派车异常,原因:{ex.Message}";
|
|
|
|
|
await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
it.BookingId,
|
|
|
|
|
it.TruckId,
|
|
|
|
|
it.TruckName,
|
|
|
|
|
it.TruckCode,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
if (entityCtnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
entityCtnList.ForEach(async ctn =>
|
|
|
|
|
{
|
|
|
|
|
ctn.TruckId = entity.Id;
|
|
|
|
|
|
|
|
|
|
await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -472,11 +485,19 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model = InnerCreateTruckFromBookingOrder(bookingId);
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
|
|
|
|
|
if (model != null && model.ContaList != null && model.ContaList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.ext = model.ContaList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"引入订舱详情生成派车信息异常,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
@ -492,9 +513,21 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
提交派车流程
|
|
|
|
|
1、先保存一遍派车信息。(需校验当前派车信息未提交,只有暂存的才能保存)
|
|
|
|
|
2、调取派车任务接口推送派车任务。
|
|
|
|
|
3、派车任务推送成功后更新状态、任务ID。
|
|
|
|
|
4、返回结果。
|
|
|
|
|
*/
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//先保存
|
|
|
|
|
var id = InnerSave(info);
|
|
|
|
|
|
|
|
|
|
//更新派车订单为已提交
|
|
|
|
|
|
|
|
|
|
//推送新增派车任务接口
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -514,6 +547,13 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
批量提交派车流程
|
|
|
|
|
1、需校验当前派车信息未提交
|
|
|
|
|
2、调取派车任务接口推送派车任务。
|
|
|
|
|
3、派车任务推送成功后更新状态、任务ID。
|
|
|
|
|
4、返回结果。
|
|
|
|
|
*/
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -534,6 +574,14 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpGet("/BookingTruck/Cancel")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Cancel(long id)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
撤销派车流程
|
|
|
|
|
1、确定当前派车已提交。
|
|
|
|
|
2、调取取消派车任务接口,申请撤销派车。
|
|
|
|
|
3、取消派车推送成功后更新状态。
|
|
|
|
|
4、返回结果。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
@ -557,6 +605,13 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
批量撤销派车流程
|
|
|
|
|
1、确定当前派车已提交。
|
|
|
|
|
2、调取取消派车任务接口,申请撤销派车。
|
|
|
|
|
3、取消派车推送成功后更新状态。
|
|
|
|
|
4、返回结果。
|
|
|
|
|
*/
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|