diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
index d7283740..9ab4a93c 100644
--- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
+++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
@@ -595,7 +595,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
- result.msg = $"提交异常,原因:{ex.Message}";
+ result.msg = ex.GetMessage();
}
return result;
@@ -631,7 +631,7 @@ namespace Myshipping.Application
var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if (model == null)
- throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废");
+ throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
//校验
ValidateTruck(OperateTypeEnum.Submit, new BookingTruck[] { model });
@@ -688,7 +688,7 @@ namespace Myshipping.Application
if (!taskRlt.succ)
{
- throw Oops.Oh($"请求派车调度失败,原因={taskRlt.msg}");
+ throw Oops.Oh($"请求派车调度失败,原因={taskRlt.msg}", typeof(InvalidOperationException));
}
//更新派车订单为已提交
@@ -706,7 +706,8 @@ namespace Myshipping.Application
it.Status,
it.UpdatedTime,
it.UpdatedUserId,
- it.UpdatedUserName
+ it.UpdatedUserName,
+ it.TaskNo
}).ExecuteCommandAsync();
@@ -716,7 +717,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
- result.msg = $"提交异常,原因:{ex.Message}";
+ result.msg = ex.GetMessage("提交失败");
}
return result;
@@ -1010,36 +1011,25 @@ namespace Myshipping.Application
/// 派车主键
/// 返回回执
[HttpGet("/BookingTruck/Delete")]
- public async Task Delete(long id)
+ public async Task Delete(long id)
{
- TaskManageOrderResultDto result = new TaskManageOrderResultDto();
+ //检索
+ var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
- try
- {
- //检索
- var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
+ if (truckOrder == null)
+ throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
- if(truckOrder == null)
- throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
+ //先校验
+ ValidateTruck(OperateTypeEnum.Delete, new BookingTruck[] { truckOrder });
- //先校验
- ValidateTruck(OperateTypeEnum.Delete, new BookingTruck[] { truckOrder });
+ await _bookingTruckRepository.UpdateAsync(x => x.Id == id,
+ x => new BookingTruck { IsDeleted = true });
- await _bookingTruckRepository.UpdateAsync(x => x.Id == id,
- x => new BookingTruck { IsDeleted = true });
- result.succ = true;
- result.msg = "删除成功";
+ _logger.LogInformation("删除派车成功 id={id} user={usr}", id, UserManager.UserId);
- _logger.LogInformation("删除派车成功 id={id} user={usr}", id, UserManager.UserId);
- }
- catch (Exception ex)
- {
- result.succ = false;
- result.msg = ex.GetMessage("删除派车异常");
- }
+ return "删除成功";
- return result;
}
///
@@ -1553,7 +1543,7 @@ namespace Myshipping.Application
if (entityArg.Any(a => a.Status != BookingTruckStatus.TEMP.ToString()
&& a.Status != BookingTruckStatus.CANCELED.ToString()))
{
- throw Oops.Oh($"派车状态只有暂存、已撤销才能保存");
+ throw Oops.Oh($"派车状态只有暂存、已撤销才能保存", typeof(InvalidOperationException));
}
}
else if (operateType == OperateTypeEnum.Submit)
@@ -1561,19 +1551,19 @@ namespace Myshipping.Application
if (entityArg.Any(a => a.Status != BookingTruckStatus.TEMP.ToString()
&& a.Status != BookingTruckStatus.CANCELED.ToString()))
{
- throw Oops.Oh($"派车状态只有暂存、已撤销才能提交");
+ throw Oops.Oh($"派车状态只有暂存、已撤销才能提交", typeof(InvalidOperationException));
}
- if(entityArg.Any(a=> a.DispatcherId == 0))
+ if(entityArg.Any(a=> !a.DispatcherId.HasValue ||(a.DispatcherId.HasValue && a.DispatcherId.Value == 0)))
{
- throw Oops.Oh($"未填写调度,不能提交");
+ throw Oops.Oh($"未填写调度,不能提交", typeof(InvalidOperationException));
}
}
else if (operateType == OperateTypeEnum.Cancel)
{
if (entityArg.Any(a => a.Status != BookingTruckStatus.SUBMITED.ToString()))
{
- throw Oops.Oh($"派车状态只有已提交才能撤销派车");
+ throw Oops.Oh($"派车状态只有已提交才能撤销派车", typeof(InvalidOperationException));
}
}
else if (operateType == OperateTypeEnum.Delete)
@@ -1581,7 +1571,7 @@ namespace Myshipping.Application
if (entityArg.Any(a => a.Status != BookingTruckStatus.TEMP.ToString()
&& a.Status != BookingTruckStatus.CANCELED.ToString()))
{
- throw Oops.Oh($"派车状态只有暂存、已撤销才能作废");
+ throw Oops.Oh($"派车状态只有暂存、已撤销才能作废", typeof(InvalidOperationException));
}
}
}
diff --git a/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs
index 7ed6f65b..5c6422c2 100644
--- a/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs
+++ b/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs
@@ -96,7 +96,7 @@ namespace Myshipping.Application
///
/// 派车主键
/// 返回回执
- Task Delete(long id);
+ Task Delete(long id);
///
/// 批量删除派车
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
index ebdd0926..5fce0f37 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
@@ -622,8 +622,6 @@ namespace Myshipping.Application
reportUrl += "/";
}
- var genUrl = $"{reportUrl}PrintReport";
-
var truckOrder = _taskTruckRepository.AsQueryable().First(a => a.PK_ID == taskTruckId);
if (truckOrder == null)
@@ -667,7 +665,7 @@ namespace Myshipping.Application
_logger.LogInformation($"taskTruckId={taskTruckId} 请求打印 JSON={JSON.Serialize(model)}");
- return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), genUrl, PRINT_DATASOURCE_KEY,
+ return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), reportUrl, PRINT_DATASOURCE_KEY,
printFileType, printTemplate);
}