cjy 3 months ago
commit d9909790c7

@ -39,7 +39,7 @@ public class SaasDbService : ISaasDbService
/// <returns></returns>
public ISqlSugarClient GetBizDb()
{
var tenantId = user.GetTenantId().ToString();
var tenantId = user.TenantId;
if (!db.IsAnyConnection(tenantId))
{

@ -43,7 +43,7 @@ namespace DS.Module.SqlSugar
{
var tenantId = ((dynamic)entityInfo.EntityValue).TenantId;
if (tenantId == null || tenantId == 0)
entityInfo.SetValue(user.GetTenantId());
entityInfo.SetValue(user.TenantId);
}
if (entityInfo.PropertyName == "TenantName")
{

@ -56,7 +56,7 @@ public static class SqlsugarInstall
{
dbList.Add(item);
}
var _serviceProvider =services.GetService<IServiceProvider>();
var _serviceProvider = services.GetService<IServiceProvider>();
ICacheService myCache = new SqlSugarCsRedisCache(_serviceProvider);
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList, myCache);
@ -178,7 +178,7 @@ public static class SqlsugarInstall
{
var tenantId = ((dynamic)entityInfo.EntityValue).TenantId;
if (tenantId == null || tenantId == 0)
entityInfo.SetValue(user.GetTenantId());
entityInfo.SetValue(user.TenantId);
}
if (entityInfo.PropertyName == "TenantName")
{
@ -253,11 +253,11 @@ public static class SqlsugarInstall
var time = it.Time;
var diffType = it.DiffType; //enum insert 、update and delete
var diffData = SqlSugarDiffUtil.GetDiff(editBeforeData,editAfterData);
var diffData = SqlSugarDiffUtil.GetDiff(editBeforeData, editAfterData);
var auditData = new SysLogAudit()
{
KeyId =Convert.ToInt64(diffData.Id),
KeyId = Convert.ToInt64(diffData.Id),
Sql = it.Sql,
Param = JsonConvert.SerializeObject(it.Parameters),
OperateType = diffType.ToString(),
@ -273,7 +273,7 @@ public static class SqlsugarInstall
};
//全局过滤租户
dbProvider.QueryFilter.AddTableFilter<ITenantId>(m => m.TenantId == user.GetTenantId());
dbProvider.QueryFilter.AddTableFilter<ITenantId>(m => m.TenantId == long.Parse(user.TenantId));
//全局过滤机构Id
dbProvider.QueryFilter.AddTableFilter<IOrgId>(m => m.OrgId == user.OrgId);
//全局软删除过滤

@ -1245,7 +1245,7 @@ namespace DS.WMS.Core.Op.Method
#endregion
//INTTRA 订舱时改用交货地来填写到目的地
if (ediRouteEnum == EDIRouteEnum.INTTRA)
if (ediRouteEnum == EDIRouteEnum.INTTRA || ediRouteEnum == EDIRouteEnum.YT)
{
#region 目的地
//目的地

@ -9,7 +9,6 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarTable("task_flow_config", "任务编排流程表")]
public class TaskFlowConfig : BaseModelV2<long>
{
/// <summary>
/// 流程名称
/// </summary>
@ -46,12 +45,6 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "下一流程主键", IsNullable = true, Length = 255)]
public string? NextConfigId { get; set; }
///// <summary>
///// 父项流程主键
///// </summary>
//[SugarColumn(ColumnDescription = "父项流程主键", IsNullable = true)]
//public long? ParentConfigId { get; set; }
/// <summary>
/// 当执行过程中发生异常时是否继续执行下一个节点
/// </summary>
@ -63,12 +56,5 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// </summary>
[SugarColumn(ColumnDescription = "当无匹配的执行流程时是否作为默认的执行流程", IsNullable = false, Length = 1)]
public bool IsUnMatchDefault { get; set; }
/// <summary>
/// 当匹配到多项执行流程时是否作为默认的执行流程
/// </summary>
[SugarColumn(ColumnDescription = "当匹配到多项执行流程时是否作为默认的执行流程", IsNullable = false, Length = 1)]
public bool IsMoreMatchDefault { get; set; }
}
}

@ -80,5 +80,10 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="taskId">任务主键</param>
/// <param name="file">BC文件</param>
Task<DataResult> UploadBcThenRunTask(string carrierCode, long taskId, IFormFile file);
/// <summary>
/// 结束BC任务并创建下一步任务
/// </summary>
Task<DataResult> BCTaskCompleteThenNext(TaskFlowDataContext dataContext);
}
}

@ -36,6 +36,8 @@ using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Text;
using System.ComponentModel.DataAnnotations;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
namespace DS.WMS.Core.TaskPlat.Method
{
@ -1343,7 +1345,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var result = await BcMatchSeaExport(taskBcInfo);
if (result.Succeeded && result.Data != null)
{
dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data!);
dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data.Id!);
await tenantDb.Updateable<TaskBCInfo>()
.SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id)
@ -2760,5 +2762,39 @@ namespace DS.WMS.Core.TaskPlat.Method
return DataResult.Successed("上传完成,请审核相关任务及订单状态", MultiLanguageConst.UploadBcThenRunTaskSuccess);
}
/// <summary>
/// 结束BC任务并创建下一步任务
/// </summary>
/// <param name="dataContext">数据上下文</param>
public async Task<DataResult> BCTaskCompleteThenNext(TaskFlowDataContext dataContext)
{
var businessId = dataContext.Get<long?>(TaskFlowDataNameConst.BusinessId);
if (businessId == null || businessId == 0)
{
Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时未获取到businessId{businessId}");
return DataResult.Failed("未获取到订单Id");
}
else
{
var taskService = serviceProvider.GetRequiredService<ITaskService>();
var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest()
{
AutoCreateNext = true,
BusinessId = (long)businessId,
BusinessType = BusinessType.OceanShippingExport,
TaskStatus = TaskStatusEnum.Complete,
TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString()
});
if (rlt.Succeeded)
{
return DataResult.Successed("BC任务已完成并创建下一步任务");
}
else
{
return DataResult.Failed(rlt.Message);
}
}
}
}
}

@ -296,7 +296,6 @@ namespace DS.WMS.Core.TaskPlat.Method
.WhereIF(info.Main.IsCheckExistsByTaskType, t => t.TASK_TYPE == info.Main.TaskType.ToString())
.OrderByDescending(a => a.Id)
.FirstAsync();
}
// 只要任务最后一次处理任务的状态是已取消、已完成,就可以重入新的任务
@ -2843,17 +2842,23 @@ namespace DS.WMS.Core.TaskPlat.Method
var order = await tenantDb.Queryable<SeaExport>().Select<Core.Op.Dtos.SeaExportRes>().FirstAsync(x => x.Id == 1816649497120477184);
TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.Business, order)
//("hasCabin", "false")
);
TaskFlowRuner runer = new TaskFlowRuner(tenantDb, serviceProvider);
var result1 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, null); // 首位
//var result2 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20001); // 正常
//var result3 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20002); // 分支判断
//var result4 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20003); // 分支结尾判断
//var result5 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20008); // 末位
//var result12 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, null); // 首位
//var result22 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, TaskBaseTypeEnum.WAIT_BOOKING); // 正常
var result22 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, TaskBaseTypeEnum.WAIT_BOOKING); // 正常
break;
}
// 结束BC任务并创建下一步任务测试
case 4:
{
//TaskFlowDataContext dataContext2 = new(
// (TaskFlowDataNameConst.BusinessId, 31232312)
//);
//TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider);
//await taskFlow.Run(TaskBaseTypeEnum., taskId, dataContext);
break;
}
}

@ -216,7 +216,7 @@ namespace DS.WMS.Core.TaskPlat
dataContext.Set(paramItem.FieldName!, paramItem.FieldValue!);
}
if (executeConfig.ExecuteModuleId == 0)
if (executeConfig.ExecuteModuleId == 0 || executeConfig.ExecuteModuleId == null)
{
flowLogDetail.ElapsedMillisecond = 0;
flowLogDetail.IsComplete = true;

Loading…
Cancel
Save