wet 2 years ago
commit 23e9cd0c9d

@ -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,16 +1011,12 @@ namespace Myshipping.Application
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/Delete")]
public async Task<TaskManageOrderResultDto> Delete(long id)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
public async Task<string> Delete(long id)
{
//检索
var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if(truckOrder == null)
if (truckOrder == null)
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
//先校验
@ -1028,18 +1025,11 @@ namespace Myshipping.Application
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);
}
catch (Exception ex)
{
result.succ = false;
result.msg = ex.GetMessage("删除派车异常");
}
return result;
return "删除成功";
}
/// <summary>
@ -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));
}
}
}

@ -96,7 +96,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="id">派车主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> Delete(long id);
Task<string> Delete(long id);
/// <summary>
/// 批量删除派车

@ -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);
}

Loading…
Cancel
Save