批量创建关联任务存在时返回提示

dev
嵇文龙 2 months ago
parent a7c0fa68de
commit a2d70cc517

@ -1519,7 +1519,8 @@ public static class MultiLanguageConst
public const string BookingTaskNotFound = "Booking_Task_NotFound";
[Description("此操作不支持多种业务类型同时提交")]
public const string MultiBusinessType = "Multi_Business_Type";
[Description("订单:{0} 已提交")]
public const string OrderTaskSubmitted = "Order_Task_Submitted";
[Description("任务邮件必须设置收件人")]
public const string TaskMailReceiverNotNull = "Task_Mail_Receiver_Not_Null";
[Description("任务邮件必须设置发件人")]

@ -146,19 +146,25 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
var ids = request.Ids;
ids ??= [request.BusinessId];
if (ids.Length == 0)
return DataResult.FailedWithDesc(MultiLanguageConst.IllegalRequest);
List<string> strList = [];
DataResult result;
for (int i = 0; i < ids.Length; i++)
{
request.BusinessId = ids[i];
result = await CreateTaskAsync(request, useTransaction);
if (!result.Succeeded)
return result;
{
if (result.Data == null)
return result;
strList.Add(result.Data.ToString()!);
}
}
return DataResult.Success;
if (strList.Count == 0)
return DataResult.Success;
return DataResult.Failed(string.Format(MultiLanguageConst.OrderTaskSubmitted, string.Join("、", strList)));
}
/// <summary>
@ -180,6 +186,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
request.TaskTypeName = nextType.Value.ToString();
}
DataResult result = DataResult.Success;
bool updateFlag = false;
var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
if (task != null)
@ -191,11 +198,19 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
else //其他任务类型返回已存在提示
{
if (IsOrderType(request.TaskType))
{
string custNO = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == request.BusinessId)
.Select(x => x.CustomerNo).FirstAsync();
result = DataResult.Failed(string.Format(MultiLanguageConst.OrderTaskSubmitted, custNO));
result.Data = custNO;
return result;
}
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
}
}
DataResult result = DataResult.Success;
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{
result = await CheckRulesAsync(request.BusinessId, request.BusinessType.Value, RuleEngineType.COMMON_ORDER_AUDIT);

Loading…
Cancel
Save