diff --git a/Myshipping.Application/Enum/OperateTypeEnum.cs b/Myshipping.Application/Enum/OperateTypeEnum.cs
index e38de1d0..12534d4d 100644
--- a/Myshipping.Application/Enum/OperateTypeEnum.cs
+++ b/Myshipping.Application/Enum/OperateTypeEnum.cs
@@ -41,6 +41,11 @@ namespace Myshipping.Application
/// 取消派车
///
[Description("取消派车")]
- CancelDispatch
+ CancelDispatch,
+ ///
+ /// 派车回写详情
+ ///
+ [Description("派车回写详情")]
+ DispatchBackSave
}
}
diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
index 4d75a0dc..7860ae85 100644
--- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
+++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
@@ -124,9 +124,10 @@ namespace Myshipping.Application
/// 保存内部方法
///
/// 派车信息
+ /// 是否回写
/// 返回派车Id
[SqlSugarUnitOfWork]
- private async Task InnerSave(BookingTruckDto info)
+ private async Task InnerSave(BookingTruckDto info,bool isCallBack = false)
{
BookingTruck entity = info.Adapt();
@@ -154,10 +155,10 @@ namespace Myshipping.Application
}
- if (entity.Id == 0)
+ if (entity.Id == 0 && !isCallBack)
{
entity.Status = BookingTruckStatus.TEMP.ToString();
-
+
_bookingTruckRepository.Insert(entity);
if (entityCtnList != null && entityCtnList.Count > 0)
@@ -174,15 +175,25 @@ 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
{
@@ -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 = "保存成功";
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
index 8c12c315..ee17504a 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs
@@ -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>();
+ 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)
{