From 571de61f11d4b24ed987be76cb15a651d35716f3 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 7 Nov 2024 14:38:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E2=80=9C=E6=98=AF=E5=90=A6=E7=94=9F=E6=88=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E2=80=9D=E7=9A=84=E7=BB=B4=E6=8A=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 3 + .../Enums/TaskPlat/TaskConfigTypeCodeEnum.cs | 7 +- ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj | 1 + .../TaskPlat/Dtos/CreateTaskConfigDto.cs | 23 +++++ .../TaskPlat/Entity/TaskFlowTypeConfig.cs | 16 ++-- .../TaskPlat/Interface/ITaskManageService.cs | 12 +++ .../TaskPlat/Method/TaskManageService.cs | 83 +++++++++++++++++++ .../Controllers/TaskManageController.cs | 20 +++++ 8 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/CreateTaskConfigDto.cs diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index ed4a01da..75b2b33b 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1614,6 +1614,9 @@ public static class MultiLanguageConst [Description("所选任务中存在非当前登陆人待处理的任务,请检查您是否在以下任务的接收人列表之内,任务流水号:{0}")] public const string TaskNotHaveAuthor = "TaskNotHaveAuthor"; + + [Description("任务类型不正确")] + public const string TaskTypeError = "TaskTypeError"; #endregion #region 邮件解析配置 diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskConfigTypeCodeEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskConfigTypeCodeEnum.cs index 31672331..d0a986f3 100644 --- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskConfigTypeCodeEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskConfigTypeCodeEnum.cs @@ -1,4 +1,6 @@ -namespace DS.Module.Core.Enums.TaskPlat +using System.ComponentModel; + +namespace DS.Module.Core.Enums.TaskPlat { /// /// 任务配置类型编码 @@ -6,8 +8,9 @@ public enum TaskConfigTypeCodeEnum { /// - /// 不创建任务 + /// 不生成任务 /// + [Description("不生成任务")] NotCreateTask = 0 } } diff --git a/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj b/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj index 53ef0798..76141ffd 100644 --- a/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj +++ b/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj @@ -11,6 +11,7 @@ bin\Debug\net8.0\Data.xml + ..\DS.WMS.TaskApi\bin\Debug\net8.0\Data.xml diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/CreateTaskConfigDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/CreateTaskConfigDto.cs new file mode 100644 index 00000000..70ad72e0 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/CreateTaskConfigDto.cs @@ -0,0 +1,23 @@ +namespace DS.WMS.Core.TaskPlat.Dtos +{ + /// + /// 是否创建任务配置列表查询结果Dto + /// + public class CreateTaskConfigDto + { + /// + /// 任务类型编码 + /// + public string TaskTypeCode { get; set; } + + /// + /// 任务类型名称 + /// + public string TaskTypeName { get; set; } + + /// + /// 是否创建 + /// + public bool IsCreate { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowTypeConfig.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowTypeConfig.cs index d1a1c9ad..ebfb3771 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowTypeConfig.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowTypeConfig.cs @@ -12,8 +12,8 @@ namespace DS.WMS.Core.TaskPlat.Entity /// /// 任务类型 /// - [SugarColumn(ColumnDescription = "所属任务类型", IsNullable = false, Length = 255)] - public required string TaskType { get; set; } + [SugarColumn(ColumnDescription = "所属任务类型", IsNullable = false, Length = 255,DefaultValue ="")] + public string TaskType { get; set; } = ""; ///// ///// 是否创建任务 1=创建 @@ -24,19 +24,19 @@ namespace DS.WMS.Core.TaskPlat.Entity /// /// 配置类型编码 /// - [SugarColumn(ColumnDescription = "配置类型编码", IsNullable = false, Length = 255)] - public required string ConfigTypeCode { get; set; } + [SugarColumn(ColumnDescription = "配置类型编码", IsNullable = false, Length = 255, DefaultValue = "")] + public string ConfigTypeCode { get; set; } = ""; /// /// 配置类型名称 /// - [SugarColumn(ColumnDescription = "配置类型名称", IsNullable = false, Length = 255)] - public required string ConfigTypeName { get; set; } + [SugarColumn(ColumnDescription = "配置类型名称", IsNullable = false, Length = 255, DefaultValue = "")] + public string ConfigTypeName { get; set; } = ""; /// /// 配置值 /// - [SugarColumn(ColumnDescription = "配置值", IsNullable = false, Length = 255)] - public required string ConfigValue { get; set; } + [SugarColumn(ColumnDescription = "配置值", IsNullable = false, Length = 255, DefaultValue = "")] + public string ConfigValue { get; set; } = ""; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs index 7e740b1e..0a40a16b 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -110,5 +110,17 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 任务台台账子任务列表查询 /// Task>> GetChildTaskList(long taskId); + + /// + /// 保存任务是否生成的配置 + /// + /// 任务类型编码 + /// 是否生成任务 + Task SaveCreateTaskConfig(string taskTypeCode, bool isCreate); + + /// + /// 获取任务是否生成的配置列表 + /// + Task>> GetCreateTaskConfigList(); } } 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 0679c65c..0c67d700 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -4413,6 +4413,89 @@ namespace DS.WMS.Core.TaskPlat.Method return DataResult.Successed("测试成功"); } + + #region 任务台配置维护相关 + /// + /// 获取任务是否生成配置列表 + /// + public async Task>> GetCreateTaskConfigList() + { + var type = typeof(TaskBaseTypeEnum); + List allServiceItemTask = Enum.GetValues(type) + .Cast() + .Where(x => Convert.ToInt32(x) >= 300 && Convert.ToInt32(x) < 400) + .ToList(); + + var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + var noCreateTaskType = await GetNotCreateTaskTypeList(tenantDb); + + var result = allServiceItemTask.Select(x => new CreateTaskConfigDto() + { + TaskTypeCode = x.ToString(), + TaskTypeName = x.EnumDescription(), + IsCreate = !noCreateTaskType.Contains(x) + }).ToList(); + return DataResult>.Success(result); + } + + /// + /// 保存任务是否生成的配置 + /// + /// 任务类型编码 + /// 是否生成任务 + public async Task SaveCreateTaskConfig(string taskTypeCode, bool isCreate) + { + var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + if (!Enum.TryParse(typeof(TaskBaseTypeEnum), taskTypeCode, out _)) + { + return DataResult.FailedWithDesc(MultiLanguageConst.TaskTypeError); + } + + var configTypeStr = TaskConfigTypeCodeEnum.NotCreateTask.ToString(); + + var notCreateTaskConfigList = await tenantDb.Queryable() + .Where(x => x.ConfigTypeCode == configTypeStr && x.TaskType == taskTypeCode) + //.Select(x => x.Id) + .ToListAsync(); + try + { + await tenantDb.Ado.BeginTranAsync(); + + if (notCreateTaskConfigList.Count > 1) + { + var ids = notCreateTaskConfigList.Select(x => x.Id); + await tenantDb.Deleteable().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync(); + } + + if (notCreateTaskConfigList.Count > 1 || notCreateTaskConfigList.Count == 0) + { + var model = new TaskFlowTypeConfig() + { + ConfigTypeCode = configTypeStr, + ConfigTypeName = TaskConfigTypeCodeEnum.NotCreateTask.EnumDescription(), + ConfigValue = isCreate ? "0" : "1", + TaskType = taskTypeCode + }; + await tenantDb.Insertable(model).ExecuteCommandAsync(); + } + else + { + var updateModel = notCreateTaskConfigList.First(); + updateModel.ConfigValue = isCreate ? "0" : "1"; + await tenantDb.Updateable(updateModel).ExecuteCommandAsync(); + } + + await tenantDb.Ado.CommitTranAsync(); + return DataResult.Success; + } + catch (Exception) + { + await tenantDb.Ado.RollbackTranAsync(); + throw; + } + } + #endregion } /// diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs index 2c63ef4e..9f4f70d1 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -246,4 +246,24 @@ public class TaskManageController : ApiController { return await taskManageService.PullTask(Ids); } + + /// + /// 获取任务是否生成配置列表 + /// + [HttpGet("GetCreateTaskConfigList")] + public async Task>> GetCreateTaskConfigList() + { + return await taskManageService.GetCreateTaskConfigList(); + } + + /// + /// 保存任务是否生成的配置 + /// + /// 任务类型编码 + /// 是否生成任务 + [HttpPost("SaveCreateTaskConfig")] + public async Task SaveCreateTaskConfig([FromForm] string taskTypeCode, [FromForm] bool isCreate) + { + return await taskManageService.SaveCreateTaskConfig(taskTypeCode, isCreate); + } } \ No newline at end of file From 7a2a3b66ebc59fe48a4e934364dcd72d0d0ca075 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 7 Nov 2024 17:59:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8D=95=E7=8B=AC=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.Core/Constants/ComonConst.cs | 5 ++ ds-wms-service/DS.WMS.AdminApi/nlog.config | 7 +++ ds-wms-service/DS.WMS.CheckApi/nlog.config | 7 +++ .../TaskPlat/Interface/ITaskManageService.cs | 4 +- .../TaskManageCutDateChangeService.cs | 4 +- .../TaskPOLContainerNotPickUpService.cs | 4 +- .../TaskPlat/Method/TaskManageBCService.cs | 5 +- .../TaskPlat/Method/TaskManageBaseService.cs | 16 ++++-- .../TaskPlat/Method/TaskManageService.cs | 29 +++++++--- ds-wms-service/DS.WMS.FeeApi/nlog.config | 7 +++ ds-wms-service/DS.WMS.FinanceApi/nlog.config | 7 +++ ds-wms-service/DS.WMS.MainApi/nlog.config | 13 +++-- ds-wms-service/DS.WMS.OpApi/nlog.config | 9 +++- .../Controllers/TaskManageController.cs | 4 +- ds-wms-service/DS.WMS.TaskApi/nlog.config | 53 +++++++++++-------- 15 files changed, 128 insertions(+), 46 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/ComonConst.cs b/ds-wms-service/DS.Module.Core/Constants/ComonConst.cs index ac4fba8c..16c41c42 100644 --- a/ds-wms-service/DS.Module.Core/Constants/ComonConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/ComonConst.cs @@ -19,4 +19,9 @@ public class ComonConst /// ApiUserFilter授权方式使用的Header头 /// public const string API_USER_HEADER_SECRET = "USER_SECRET"; + + /// + /// 任务台日志logger名称 + /// + public const string TASK_FLOW_LOGGER = "TaskFlowLogger"; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.AdminApi/nlog.config b/ds-wms-service/DS.WMS.AdminApi/nlog.config index 46e6f7cb..b127ed49 100644 --- a/ds-wms-service/DS.WMS.AdminApi/nlog.config +++ b/ds-wms-service/DS.WMS.AdminApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -28,6 +32,9 @@ + + + diff --git a/ds-wms-service/DS.WMS.CheckApi/nlog.config b/ds-wms-service/DS.WMS.CheckApi/nlog.config index 46e6f7cb..8e52d1f4 100644 --- a/ds-wms-service/DS.WMS.CheckApi/nlog.config +++ b/ds-wms-service/DS.WMS.CheckApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -28,6 +32,9 @@ + + + diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs index 0a40a16b..e21ee3c1 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -70,7 +70,7 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 用户Id列表,用于筛选指定用户下的任务[可选,当不为空时会设置此用户列表涉及到的相关任务的状态] /// 子业务主键[可选,当不为空时表示设置子任务的状态] /// 子业务类型 - Task SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime,bool isCheckAllChildTaskComplete, string? taskDesc = null, List? userIdList = null, + Task SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List? userIdList = null, long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null); /// /// 工作流任务转交 @@ -99,7 +99,7 @@ namespace DS.WMS.Core.TaskPlat.Interface /// /// 测试用 /// - Task TestTaskFlow(string taskType, long taskId, int testType); + Task TestTaskFlow(string taskType, long taskId, int testType, string content); /// /// 领取任务到当前登陆人(可批量) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs index 6ee898b6..d30120f1 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs @@ -38,10 +38,10 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ISeaExportCommonService _seaExportCommonService; private readonly IBookingSlotService _bookingSlotService; - public TaskManageCutDateChangeService(IUser user, ILogger logger, + public TaskManageCutDateChangeService(IUser user, ISaasDbService saasDbService, IServiceProvider serviceProvider, - IWebHostEnvironment environment) : base(user, logger, saasDbService, serviceProvider, environment) + IWebHostEnvironment environment) : base(user, saasDbService, serviceProvider, environment) { user = serviceProvider.GetRequiredService(); _seaExportService = serviceProvider.GetRequiredService(); diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs index 551c938a..99935caa 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs @@ -32,10 +32,10 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ITaskMailService _taskMailService; private readonly ITaskAllocationService _taskAllocationService; - public TaskPOLContainerNotPickUpService(IUser user, ILogger logger, + public TaskPOLContainerNotPickUpService(IUser user, ISaasDbService saasDbService, IServiceProvider serviceProvider, - IWebHostEnvironment environment) : base(user, logger, saasDbService, serviceProvider, environment) + IWebHostEnvironment environment) : base(user, saasDbService, serviceProvider, environment) { //_serviceProvider = serviceProvider; //db = serviceProvider.GetRequiredService(); 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 3bb1c1d1..9ce31e1f 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -95,7 +95,7 @@ namespace DS.WMS.Core.TaskPlat.Method public TaskManageBCService(IUser user, - ILogger logger, + //ILogger logger, ISaasDbService saasDbService, IServiceProvider serviceProvider, IWebHostEnvironment environment, @@ -110,7 +110,7 @@ namespace DS.WMS.Core.TaskPlat.Method IMappingPortService mappingPortService, ICodeCountryService codeCountryService, ICommonService commonService) - : base(user, logger, saasDbService, serviceProvider, environment) + : base(user, saasDbService, serviceProvider, environment) { _userService = userService; _userEmailService = userEmailService; @@ -3100,6 +3100,7 @@ namespace DS.WMS.Core.TaskPlat.Method { return DataResult.Failed("未获取到BC任务对象TaskBaseInfo"); } + logger.LogInformation($"BCTaskCompleteThenNext taskBaseInfo.id={taskBaseInfo.Id};taskBaseInfo.OUT_BS_NO={taskBaseInfo.OUT_BS_NO}"); await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now, false); diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs index f5669aa3..c086a7ba 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs @@ -37,7 +37,8 @@ namespace DS.WMS.Core.TaskPlat.Method { // 实例化时构建 protected readonly IUser user; - protected readonly ILogger logger; + //protected readonly ILogger logger; + protected readonly ILogger logger; protected readonly ISaasDbService saasDbService; protected readonly IServiceProvider serviceProvider; protected readonly IWebHostEnvironment environment; @@ -53,13 +54,13 @@ namespace DS.WMS.Core.TaskPlat.Method protected static readonly string completeStatusStr = TaskStatusEnum.Complete.ToString(); public TaskManageBaseService(IUser user, - ILogger logger, + //ILogger logger, ISaasDbService saasDbService, IServiceProvider serviceProvider, IWebHostEnvironment environment) { this.user = user; - this.logger = logger; + //this.logger = logger; this.saasDbService = saasDbService; this.serviceProvider = serviceProvider; this.environment = environment; @@ -69,6 +70,9 @@ namespace DS.WMS.Core.TaskPlat.Method allocationService = new Lazy(serviceProvider.GetRequiredService()); seaExportCommonService = new Lazy(serviceProvider.GetRequiredService()); djyServiceStatusService = new Lazy(serviceProvider.GetRequiredService()); + + var loggerFactory = serviceProvider.GetRequiredService(); + logger = loggerFactory.CreateLogger("TaskFlowLogger"); } /// @@ -78,6 +82,8 @@ namespace DS.WMS.Core.TaskPlat.Method /// 需要更新状态的列 public async Task SetTaskStatus(long[] taskIds, params Expression>[] columns) { + logger.LogInformation($"SetTaskStatus taskIds={string.Join(",", taskIds ?? [])}"); + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); //任务不考虑OrgId,这里去掉 tenantDb.QueryFilter.Clear(); @@ -104,6 +110,8 @@ namespace DS.WMS.Core.TaskPlat.Method /// 人员信息列表 public async Task SetTaskOwner(long[] taskIds, List userInfo) { + logger.LogInformation($"SetTaskOwner taskIds={string.Join(",", taskIds ?? [])};userInfo={JsonConvert.SerializeObject(userInfo)}"); + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); //任务不考虑OrgId,这里去掉 tenantDb.QueryFilter.Clear(); @@ -582,6 +590,7 @@ namespace DS.WMS.Core.TaskPlat.Method /// 业务主键 public async Task SetTaskStatus(long taskBaseId, TaskStatusEnum taskStatusEnum, DateTime? statusTime, long? bsno = null) { + logger.LogInformation($"SetTaskStatus taskBaseId={taskBaseId};taskStatusEnum={taskStatusEnum};statusTime={statusTime};bsno={bsno}"); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); TaskBaseInfo taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) @@ -606,6 +615,7 @@ namespace DS.WMS.Core.TaskPlat.Method { throw new ArgumentNullException(nameof(taskInfo)); } + logger.LogInformation($"SetTaskStatus 通用 taskInfo={JsonConvert.SerializeObject(taskInfo)};taskStatusEnum={taskStatusEnum};statusTime={statusTime};isCheckAllChildTaskComplete={isCheckAllChildTaskComplete};bsno={bsno};taskDesc={taskDesc}"); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); 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 0c67d700..7b95f523 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -3,6 +3,7 @@ using DS.Module.Core.Condition; using DS.Module.Core.Constants; using DS.Module.Core.Data; using DS.Module.Core.Enums; +using DS.Module.Core.Enums.TaskPlat; using DS.Module.Core.Extensions; using DS.Module.Core.Helpers; using DS.Module.DjyServiceStatus; @@ -62,7 +63,7 @@ namespace DS.WMS.Core.TaskPlat.Method static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code" public TaskManageService(IUser user, - ILogger logger, + //ILogger logger, ISaasDbService saasDbService, IServiceProvider serviceProvider, IWebHostEnvironment environment, @@ -71,7 +72,7 @@ namespace DS.WMS.Core.TaskPlat.Method IMappingPortService mappingPortService, IMappingCarrierService mappingCarrierService, ICodeCarrierService codeCarrierService, - ICommonService commonService) : base(user, logger, saasDbService, serviceProvider, environment) + ICommonService commonService) : base(user, saasDbService, serviceProvider, environment) { this.codeCtnService = codeCtnService; this.codePortService = codePortService; @@ -97,7 +98,7 @@ namespace DS.WMS.Core.TaskPlat.Method public async Task SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List userInfos, long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null) { - logger.LogInformation("接收到任务个人状态修改报文 bsno={bsno} 状态设置={status} 人员列表={userList} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}", bsno, taskStatusEnum.ToString(), JsonConvert.SerializeObject(userInfos), childBsno, childTaskBaseTypeEnum); + logger.LogInformation($"{nameof(SetTaskStatusWithBsno)} bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};userInfos={(userInfos == null ? "" : string.Join(',', userInfos ?? []))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}"); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); @@ -177,6 +178,8 @@ namespace DS.WMS.Core.TaskPlat.Method public async Task SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List? userIdList = null, long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null) { + logger.LogInformation($"SetTaskStatusWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};isCheckAllChildTaskComplete={isCheckAllChildTaskComplete};taskDesc={taskDesc};userIdList={(userIdList == null ? "" : string.Join(',', userIdList))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}"); + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); var taskTypeStr = taskBaseTypeEnum.ToString(); @@ -281,6 +284,8 @@ namespace DS.WMS.Core.TaskPlat.Method public async Task TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List userInfos, SqlSugarScopeProvider? tenantDb = null, long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null) { + logger.LogInformation($"TransferTask bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};userInfos={(userInfos == null ? "" : string.Join(',', userInfos))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}"); + tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId); logger.LogInformation("接收到任务转交报文 bsno={bsno} taskBaseTypeEnum={taskBaseTypeEnum} 转交人员列表={userinfo} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}", @@ -394,6 +399,7 @@ namespace DS.WMS.Core.TaskPlat.Method long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null, params Expression>[] columns) { + logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum};"); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); @@ -463,10 +469,10 @@ namespace DS.WMS.Core.TaskPlat.Method public async Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null) { string batchNo = Guid.NewGuid().ToString(); + logger.LogInformation($"{nameof(InitTaskJob)} bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}"); try { //Monitor.Enter(ImportLockObj); - logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, JsonConvert.SerializeObject(info)); if (info.Head.IsChild && info.Head.ChildBSNO == 0) { @@ -3858,6 +3864,7 @@ namespace DS.WMS.Core.TaskPlat.Method TaskManageOrderResultDto result = new TaskManageOrderResultDto(); result.bno = model.TASK_NO; + logger.LogInformation($"InnerManualTask batchNo={batchNo};model.OUT_BS_NO={model.OUT_BS_NO};model.Id={model.Id};taskOperTypeEnum={taskOperTypeEnum};"); try { @@ -4164,6 +4171,9 @@ namespace DS.WMS.Core.TaskPlat.Method }); var taskIdList = taskList.Select(x => x.Id).ToList(); + + logger.LogInformation($"PullTask taskIdList={string.Join(",", taskIdList)}"); + var taskTypeList = taskList.Where(x => x.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString() && x.OUT_BS_NO != null).Select(x => x.TASK_TYPE).Distinct().ToList(); var taskCompleteStatusCodeList = taskTypeList.Count > 0 ? await tenantDb.Queryable() @@ -4231,6 +4241,7 @@ namespace DS.WMS.Core.TaskPlat.Method catch (Exception ex) { await tenantDb.AsTenant().RollbackTranAsync(); + logger.LogError($"PullTask Exception 原因:{ex.Message}"); return DataResult.Failed("任务领取失败,原因:" + ex.Message); } } @@ -4239,9 +4250,8 @@ namespace DS.WMS.Core.TaskPlat.Method /// /// 测试用 /// - public async Task TestTaskFlow(string taskType, long taskId, int testType) + public async Task TestTaskFlow(string taskType, long taskId, int testType, string? content = null) { - var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); @@ -4409,6 +4419,13 @@ namespace DS.WMS.Core.TaskPlat.Method var temp2 = tenantDb.Ado.SqlQuery("select * from task_flow_module where id in(@id)", p); break; } + case 8: + { + //await serviceProvider.GetRequiredService + var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType); + await SetTaskBaseInfoPropertyWithBsno(taskId, taskTypeEnum, null, null, x => x.TASK_DESP == content); + break; + } } return DataResult.Successed("测试成功"); diff --git a/ds-wms-service/DS.WMS.FeeApi/nlog.config b/ds-wms-service/DS.WMS.FeeApi/nlog.config index 46e6f7cb..8e52d1f4 100644 --- a/ds-wms-service/DS.WMS.FeeApi/nlog.config +++ b/ds-wms-service/DS.WMS.FeeApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -28,6 +32,9 @@ + + + diff --git a/ds-wms-service/DS.WMS.FinanceApi/nlog.config b/ds-wms-service/DS.WMS.FinanceApi/nlog.config index 46e6f7cb..5ff430eb 100644 --- a/ds-wms-service/DS.WMS.FinanceApi/nlog.config +++ b/ds-wms-service/DS.WMS.FinanceApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -27,6 +31,9 @@ + + + diff --git a/ds-wms-service/DS.WMS.MainApi/nlog.config b/ds-wms-service/DS.WMS.MainApi/nlog.config index 46e6f7cb..903b948c 100644 --- a/ds-wms-service/DS.WMS.MainApi/nlog.config +++ b/ds-wms-service/DS.WMS.MainApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -28,9 +32,12 @@ - - - + + + + + + \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/nlog.config b/ds-wms-service/DS.WMS.OpApi/nlog.config index 46e6f7cb..af5a03ba 100644 --- a/ds-wms-service/DS.WMS.OpApi/nlog.config +++ b/ds-wms-service/DS.WMS.OpApi/nlog.config @@ -20,6 +20,10 @@ layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" /> + + + @@ -28,7 +32,10 @@ - + + + + diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs index 9f4f70d1..6ef479ce 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -233,9 +233,9 @@ public class TaskManageController : ApiController /// 测试用 /// [HttpGet("TestTaskFlow")] - public async Task TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId, [FromQuery] int testType) + public async Task TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId, [FromQuery] int testType, [FromQuery] string content) { - return await taskManageService.TestTaskFlow(taskType, taskId, testType); + return await taskManageService.TestTaskFlow(taskType, taskId, testType, content); } /// diff --git a/ds-wms-service/DS.WMS.TaskApi/nlog.config b/ds-wms-service/DS.WMS.TaskApi/nlog.config index 46e6f7cb..3edf57e2 100644 --- a/ds-wms-service/DS.WMS.TaskApi/nlog.config +++ b/ds-wms-service/DS.WMS.TaskApi/nlog.config @@ -4,33 +4,40 @@ autoReload="true" internalLogLevel="info" internalLogFile="Logs\internal-nlog.txt"> - - - - + + + + - - - - + + + - - + - - - + + - - - - - + + + + + + + + + + + + - - - - - + + + + + \ No newline at end of file