diff --git a/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs b/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs index 4556396e..d8dd61b5 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs @@ -39,7 +39,7 @@ public class SaasDbService : ISaasDbService /// public ISqlSugarClient GetBizDb() { - var tenantId = user.GetTenantId().ToString(); + var tenantId = user.TenantId; if (!db.IsAnyConnection(tenantId)) { diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs index 49724342..c3a1be1e 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs @@ -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") { diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs index 07794e21..60e18c1b 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs @@ -56,7 +56,7 @@ public static class SqlsugarInstall { dbList.Add(item); } - var _serviceProvider =services.GetService(); + var _serviceProvider = services.GetService(); ICacheService myCache = new SqlSugarCsRedisCache(_serviceProvider); var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList, myCache); @@ -97,7 +97,7 @@ public static class SqlsugarInstall OrgId = 1288018625843826688 }; } - + //全局上下文生效 SqlSugarScope sqlSugar = new SqlSugarScope(connectConfigList, db => @@ -108,7 +108,7 @@ public static class SqlsugarInstall foreach (var c in connectConfigList) { var dbProvider = db.GetConnectionScope((string)c.ConfigId); - + // var user = services.GetService(); //单例参数配置,所有上下文生效 @@ -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") { @@ -215,7 +215,7 @@ public static class SqlsugarInstall } } if (entityInfo.PropertyName == "Deleted") - entityInfo.SetValue(false); + entityInfo.SetValue(false); } // 更新操作 @@ -234,7 +234,7 @@ public static class SqlsugarInstall entityInfo.SetValue(user.UserId); if (entityInfo.PropertyName == "DeleteUserName" && user != null) entityInfo.SetValue(user.UserName); - } + } }; dbProvider.Aop.OnDiffLogEvent = it => @@ -253,13 +253,13 @@ 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), + Param = JsonConvert.SerializeObject(it.Parameters), OperateType = diffType.ToString(), OldValue = JsonConvert.SerializeObject(editBeforeData), NewValue = JsonConvert.SerializeObject(editAfterData), @@ -270,10 +270,10 @@ public static class SqlsugarInstall db.GetConnection(1288018625843826680).Insertable(auditData).ExecuteCommand(); #endregion } - + }; //全局过滤租户 - dbProvider.QueryFilter.AddTableFilter(m => m.TenantId == user.GetTenantId()); + dbProvider.QueryFilter.AddTableFilter(m => m.TenantId == long.Parse(user.TenantId)); //全局过滤机构Id dbProvider.QueryFilter.AddTableFilter(m => m.OrgId == user.OrgId); //全局软删除过滤 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs index 7b8762a4..ce8f0dca 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs @@ -1245,7 +1245,7 @@ namespace DS.WMS.Core.Op.Method #endregion //INTTRA 订舱时改用交货地来填写到目的地 - if (ediRouteEnum == EDIRouteEnum.INTTRA) + if (ediRouteEnum == EDIRouteEnum.INTTRA || ediRouteEnum == EDIRouteEnum.YT) { #region 目的地 //目的地 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowConfig.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowConfig.cs index dfe4f160..e8fcefde 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowConfig.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowConfig.cs @@ -9,7 +9,6 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarTable("task_flow_config", "任务编排流程表")] public class TaskFlowConfig : BaseModelV2 { - /// /// 流程名称 /// @@ -46,12 +45,6 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarColumn(ColumnDescription = "下一流程主键", IsNullable = true, Length = 255)] public string? NextConfigId { get; set; } - ///// - ///// 父项流程主键 - ///// - //[SugarColumn(ColumnDescription = "父项流程主键", IsNullable = true)] - //public long? ParentConfigId { get; set; } - /// /// 当执行过程中发生异常时是否继续执行下一个节点 /// @@ -63,12 +56,5 @@ namespace DS.WMS.Core.TaskPlat.Entity /// [SugarColumn(ColumnDescription = "当无匹配的执行流程时是否作为默认的执行流程", IsNullable = false, Length = 1)] public bool IsUnMatchDefault { get; set; } - - /// - /// 当匹配到多项执行流程时是否作为默认的执行流程 - /// - [SugarColumn(ColumnDescription = "当匹配到多项执行流程时是否作为默认的执行流程", IsNullable = false, Length = 1)] - public bool IsMoreMatchDefault { get; set; } } - } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs index 4af728ad..fb2da657 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs @@ -80,5 +80,10 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 任务主键 /// BC文件 Task UploadBcThenRunTask(string carrierCode, long taskId, IFormFile file); + + /// + /// 结束BC任务并创建下一步任务 + /// + Task BCTaskCompleteThenNext(TaskFlowDataContext dataContext); } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs index 5881983c..5bf718d1 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -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() .SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id) @@ -2760,5 +2762,39 @@ namespace DS.WMS.Core.TaskPlat.Method return DataResult.Successed("上传完成,请审核相关任务及订单状态", MultiLanguageConst.UploadBcThenRunTaskSuccess); } + + /// + /// 结束BC任务并创建下一步任务 + /// + /// 数据上下文 + public async Task BCTaskCompleteThenNext(TaskFlowDataContext dataContext) + { + var businessId = dataContext.Get(TaskFlowDataNameConst.BusinessId); + if (businessId == null || businessId == 0) + { + Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}"); + return DataResult.Failed("未获取到订单Id"); + } + else + { + var taskService = serviceProvider.GetRequiredService(); + 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); + } + } + } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 89482c76..ccc93eda 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -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().Select().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; } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs index 14aa8307..7f4c4f26 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs @@ -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;