cjy 3 weeks ago
commit bb5ac8004c

@ -19,4 +19,9 @@ public class ComonConst
/// ApiUserFilter授权方式使用的Header头 /// ApiUserFilter授权方式使用的Header头
/// </summary> /// </summary>
public const string API_USER_HEADER_SECRET = "USER_SECRET"; public const string API_USER_HEADER_SECRET = "USER_SECRET";
/// <summary>
/// 任务台日志logger名称
/// </summary>
public const string TASK_FLOW_LOGGER = "TaskFlowLogger";
} }

@ -1614,6 +1614,9 @@ public static class MultiLanguageConst
[Description("所选任务中存在非当前登陆人待处理的任务,请检查您是否在以下任务的接收人列表之内,任务流水号:{0}")] [Description("所选任务中存在非当前登陆人待处理的任务,请检查您是否在以下任务的接收人列表之内,任务流水号:{0}")]
public const string TaskNotHaveAuthor = "TaskNotHaveAuthor"; public const string TaskNotHaveAuthor = "TaskNotHaveAuthor";
[Description("任务类型不正确")]
public const string TaskTypeError = "TaskTypeError";
#endregion #endregion
#region 邮件解析配置 #region 邮件解析配置

@ -1,4 +1,6 @@
namespace DS.Module.Core.Enums.TaskPlat using System.ComponentModel;
namespace DS.Module.Core.Enums.TaskPlat
{ {
/// <summary> /// <summary>
/// 任务配置类型编码 /// 任务配置类型编码
@ -6,8 +8,9 @@
public enum TaskConfigTypeCodeEnum public enum TaskConfigTypeCodeEnum
{ {
/// <summary> /// <summary>
/// 不创建任务 /// 不生成任务
/// </summary> /// </summary>
[Description("不生成任务")]
NotCreateTask = 0 NotCreateTask = 0
} }
} }

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 将任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -11,6 +11,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DocumentationFile>bin\Debug\net8.0\Data.xml</DocumentationFile> <DocumentationFile>bin\Debug\net8.0\Data.xml</DocumentationFile>
<DocumentationFile>..\DS.WMS.TaskApi\bin\Debug\net8.0\Data.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

@ -0,0 +1,23 @@
namespace DS.WMS.Core.TaskPlat.Dtos
{
/// <summary>
/// 是否创建任务配置列表查询结果Dto
/// </summary>
public class CreateTaskConfigDto
{
/// <summary>
/// 任务类型编码
/// </summary>
public string TaskTypeCode { get; set; }
/// <summary>
/// 任务类型名称
/// </summary>
public string TaskTypeName { get; set; }
/// <summary>
/// 是否创建
/// </summary>
public bool IsCreate { get; set; }
}
}

@ -12,8 +12,8 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// <summary> /// <summary>
/// 任务类型 /// 任务类型
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "所属任务类型", IsNullable = false, Length = 255)] [SugarColumn(ColumnDescription = "所属任务类型", IsNullable = false, Length = 255,DefaultValue ="")]
public required string TaskType { get; set; } public string TaskType { get; set; } = "";
///// <summary> ///// <summary>
///// 是否创建任务 1=创建 ///// 是否创建任务 1=创建
@ -24,19 +24,19 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// <summary> /// <summary>
/// 配置类型编码 /// 配置类型编码
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "配置类型编码", IsNullable = false, Length = 255)] [SugarColumn(ColumnDescription = "配置类型编码", IsNullable = false, Length = 255, DefaultValue = "")]
public required string ConfigTypeCode { get; set; } public string ConfigTypeCode { get; set; } = "";
/// <summary> /// <summary>
/// 配置类型名称 /// 配置类型名称
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "配置类型名称", IsNullable = false, Length = 255)] [SugarColumn(ColumnDescription = "配置类型名称", IsNullable = false, Length = 255, DefaultValue = "")]
public required string ConfigTypeName { get; set; } public string ConfigTypeName { get; set; } = "";
/// <summary> /// <summary>
/// 配置值 /// 配置值
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "配置值", IsNullable = false, Length = 255)] [SugarColumn(ColumnDescription = "配置值", IsNullable = false, Length = 255, DefaultValue = "")]
public required string ConfigValue { get; set; } public string ConfigValue { get; set; } = "";
} }
} }

@ -99,7 +99,7 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <summary> /// <summary>
/// 测试用 /// 测试用
/// </summary> /// </summary>
Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType); Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType, string content);
/// <summary> /// <summary>
/// 领取任务到当前登陆人(可批量) /// 领取任务到当前登陆人(可批量)
@ -110,5 +110,17 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 任务台台账子任务列表查询 /// 任务台台账子任务列表查询
/// </summary> /// </summary>
Task<DataResult<List<dynamic>>> GetChildTaskList(long taskId); Task<DataResult<List<dynamic>>> GetChildTaskList(long taskId);
/// <summary>
/// 保存任务是否生成的配置
/// </summary>
/// <param name="taskTypeCode">任务类型编码</param>
/// <param name="isCreate">是否生成任务</param>
Task<DataResult> SaveCreateTaskConfig(string taskTypeCode, bool isCreate);
/// <summary>
/// 获取任务是否生成的配置列表
/// </summary>
Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList();
} }
} }

@ -38,10 +38,10 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly ISeaExportCommonService _seaExportCommonService; private readonly ISeaExportCommonService _seaExportCommonService;
private readonly IBookingSlotService _bookingSlotService; private readonly IBookingSlotService _bookingSlotService;
public TaskManageCutDateChangeService(IUser user, ILogger<TaskManageCutDateChangeService> logger, public TaskManageCutDateChangeService(IUser user,
ISaasDbService saasDbService, ISaasDbService saasDbService,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IWebHostEnvironment environment) : base(user, logger, saasDbService, serviceProvider, environment) IWebHostEnvironment environment) : base(user, saasDbService, serviceProvider, environment)
{ {
user = serviceProvider.GetRequiredService<IUser>(); user = serviceProvider.GetRequiredService<IUser>();
_seaExportService = serviceProvider.GetRequiredService<ISeaExportService>(); _seaExportService = serviceProvider.GetRequiredService<ISeaExportService>();

@ -32,10 +32,10 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly ITaskMailService _taskMailService; private readonly ITaskMailService _taskMailService;
private readonly ITaskAllocationService _taskAllocationService; private readonly ITaskAllocationService _taskAllocationService;
public TaskPOLContainerNotPickUpService(IUser user, ILogger<TaskPOLContainerNotPickUpService> logger, public TaskPOLContainerNotPickUpService(IUser user,
ISaasDbService saasDbService, ISaasDbService saasDbService,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IWebHostEnvironment environment) : base(user, logger, saasDbService, serviceProvider, environment) IWebHostEnvironment environment) : base(user, saasDbService, serviceProvider, environment)
{ {
//_serviceProvider = serviceProvider; //_serviceProvider = serviceProvider;
//db = serviceProvider.GetRequiredService<ISqlSugarClient>(); //db = serviceProvider.GetRequiredService<ISqlSugarClient>();

@ -95,7 +95,7 @@ namespace DS.WMS.Core.TaskPlat.Method
public TaskManageBCService(IUser user, public TaskManageBCService(IUser user,
ILogger<TaskManageBCService> logger, //ILogger<TaskManageBCService> logger,
ISaasDbService saasDbService, ISaasDbService saasDbService,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IWebHostEnvironment environment, IWebHostEnvironment environment,
@ -110,7 +110,7 @@ namespace DS.WMS.Core.TaskPlat.Method
IMappingPortService mappingPortService, IMappingPortService mappingPortService,
ICodeCountryService codeCountryService, ICodeCountryService codeCountryService,
ICommonService commonService) ICommonService commonService)
: base(user, logger, saasDbService, serviceProvider, environment) : base(user, saasDbService, serviceProvider, environment)
{ {
_userService = userService; _userService = userService;
_userEmailService = userEmailService; _userEmailService = userEmailService;
@ -3100,6 +3100,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{ {
return DataResult.Failed("未获取到BC任务对象TaskBaseInfo"); 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); await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now, false);

@ -37,7 +37,8 @@ namespace DS.WMS.Core.TaskPlat.Method
{ {
// 实例化时构建 // 实例化时构建
protected readonly IUser user; protected readonly IUser user;
protected readonly ILogger<T> logger; //protected readonly ILogger<T> logger;
protected readonly ILogger logger;
protected readonly ISaasDbService saasDbService; protected readonly ISaasDbService saasDbService;
protected readonly IServiceProvider serviceProvider; protected readonly IServiceProvider serviceProvider;
protected readonly IWebHostEnvironment environment; protected readonly IWebHostEnvironment environment;
@ -53,13 +54,13 @@ namespace DS.WMS.Core.TaskPlat.Method
protected static readonly string completeStatusStr = TaskStatusEnum.Complete.ToString(); protected static readonly string completeStatusStr = TaskStatusEnum.Complete.ToString();
public TaskManageBaseService(IUser user, public TaskManageBaseService(IUser user,
ILogger<T> logger, //ILogger<T> logger,
ISaasDbService saasDbService, ISaasDbService saasDbService,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IWebHostEnvironment environment) IWebHostEnvironment environment)
{ {
this.user = user; this.user = user;
this.logger = logger; //this.logger = logger;
this.saasDbService = saasDbService; this.saasDbService = saasDbService;
this.serviceProvider = serviceProvider; this.serviceProvider = serviceProvider;
this.environment = environment; this.environment = environment;
@ -69,6 +70,9 @@ namespace DS.WMS.Core.TaskPlat.Method
allocationService = new Lazy<ITaskAllocationService>(serviceProvider.GetRequiredService<ITaskAllocationService>()); allocationService = new Lazy<ITaskAllocationService>(serviceProvider.GetRequiredService<ITaskAllocationService>());
seaExportCommonService = new Lazy<ISeaExportCommonService>(serviceProvider.GetRequiredService<ISeaExportCommonService>()); seaExportCommonService = new Lazy<ISeaExportCommonService>(serviceProvider.GetRequiredService<ISeaExportCommonService>());
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>()); djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>());
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
logger = loggerFactory.CreateLogger("TaskFlowLogger");
} }
/// <summary> /// <summary>
@ -78,6 +82,8 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <param name="columns">需要更新状态的列</param> /// <param name="columns">需要更新状态的列</param>
public async Task SetTaskStatus(long[] taskIds, params Expression<Func<TaskBaseInfo, bool>>[] columns) public async Task SetTaskStatus(long[] taskIds, params Expression<Func<TaskBaseInfo, bool>>[] columns)
{ {
logger.LogInformation($"SetTaskStatus taskIds={string.Join(",", taskIds ?? [])}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
//任务不考虑OrgId,这里去掉 //任务不考虑OrgId,这里去掉
tenantDb.QueryFilter.Clear<IOrgId>(); tenantDb.QueryFilter.Clear<IOrgId>();
@ -104,6 +110,8 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <param name="userInfo">人员信息列表</param> /// <param name="userInfo">人员信息列表</param>
public async Task SetTaskOwner(long[] taskIds, List<RecvUserInfo> userInfo) public async Task SetTaskOwner(long[] taskIds, List<RecvUserInfo> userInfo)
{ {
logger.LogInformation($"SetTaskOwner taskIds={string.Join(",", taskIds ?? [])};userInfo={JsonConvert.SerializeObject(userInfo)}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
//任务不考虑OrgId,这里去掉 //任务不考虑OrgId,这里去掉
tenantDb.QueryFilter.Clear<IOrgId>(); tenantDb.QueryFilter.Clear<IOrgId>();
@ -582,6 +590,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <param name="bsno">业务主键</param> /// <param name="bsno">业务主键</param>
public async Task<DataResult> SetTaskStatus(long taskBaseId, TaskStatusEnum taskStatusEnum, DateTime? statusTime, long? bsno = null) public async Task<DataResult> 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); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId)) TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId))
@ -606,6 +615,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{ {
throw new ArgumentNullException(nameof(taskInfo)); 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); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);

@ -3,6 +3,7 @@ using DS.Module.Core.Condition;
using DS.Module.Core.Constants; using DS.Module.Core.Constants;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Enums; using DS.Module.Core.Enums;
using DS.Module.Core.Enums.TaskPlat;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers; using DS.Module.Core.Helpers;
using DS.Module.DjyServiceStatus; 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" static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code"
public TaskManageService(IUser user, public TaskManageService(IUser user,
ILogger<TaskManageService> logger, //ILogger<TaskManageService> logger,
ISaasDbService saasDbService, ISaasDbService saasDbService,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IWebHostEnvironment environment, IWebHostEnvironment environment,
@ -71,7 +72,7 @@ namespace DS.WMS.Core.TaskPlat.Method
IMappingPortService mappingPortService, IMappingPortService mappingPortService,
IMappingCarrierService mappingCarrierService, IMappingCarrierService mappingCarrierService,
ICodeCarrierService codeCarrierService, ICodeCarrierService codeCarrierService,
ICommonService commonService) : base(user, logger, saasDbService, serviceProvider, environment) ICommonService commonService) : base(user, saasDbService, serviceProvider, environment)
{ {
this.codeCtnService = codeCtnService; this.codeCtnService = codeCtnService;
this.codePortService = codePortService; this.codePortService = codePortService;
@ -97,7 +98,7 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos, public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos,
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null) 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); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
@ -177,6 +178,8 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task<DataResult> SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List<long>? userIdList = null, public async Task<DataResult> SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List<long>? userIdList = null,
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = 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); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var taskTypeStr = taskBaseTypeEnum.ToString(); var taskTypeStr = taskBaseTypeEnum.ToString();
@ -281,6 +284,8 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null, public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null,
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = 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); tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId);
logger.LogInformation("接收到任务转交报文 bsno={bsno} taskBaseTypeEnum={taskBaseTypeEnum} 转交人员列表={userinfo} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}", 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, long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null,
params Expression<Func<TaskBaseInfo, bool>>[] columns) params Expression<Func<TaskBaseInfo, bool>>[] columns)
{ {
logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum};");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
@ -463,10 +469,10 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null) public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
{ {
string batchNo = Guid.NewGuid().ToString(); string batchNo = Guid.NewGuid().ToString();
logger.LogInformation($"{nameof(InitTaskJob)} bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}");
try try
{ {
//Monitor.Enter(ImportLockObj); //Monitor.Enter(ImportLockObj);
logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, JsonConvert.SerializeObject(info));
if (info.Head.IsChild && info.Head.ChildBSNO == 0) if (info.Head.IsChild && info.Head.ChildBSNO == 0)
{ {
@ -3858,6 +3864,7 @@ namespace DS.WMS.Core.TaskPlat.Method
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
result.bno = model.TASK_NO; 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 try
{ {
@ -4164,6 +4171,9 @@ namespace DS.WMS.Core.TaskPlat.Method
}); });
var taskIdList = taskList.Select(x => x.Id).ToList(); 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 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<TaskFlowModule>() var taskCompleteStatusCodeList = taskTypeList.Count > 0 ? await tenantDb.Queryable<TaskFlowModule>()
@ -4231,6 +4241,7 @@ namespace DS.WMS.Core.TaskPlat.Method
catch (Exception ex) catch (Exception ex)
{ {
await tenantDb.AsTenant().RollbackTranAsync(); await tenantDb.AsTenant().RollbackTranAsync();
logger.LogError($"PullTask Exception 原因:{ex.Message}");
return DataResult.Failed("任务领取失败,原因:" + ex.Message); return DataResult.Failed("任务领取失败,原因:" + ex.Message);
} }
} }
@ -4239,9 +4250,8 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <summary> /// <summary>
/// 测试用 /// 测试用
/// </summary> /// </summary>
public async Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType) public async Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType, string? content = null)
{ {
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
@ -4409,10 +4419,100 @@ namespace DS.WMS.Core.TaskPlat.Method
var temp2 = tenantDb.Ado.SqlQuery<dynamic>("select * from task_flow_module where id in(@id)", p); var temp2 = tenantDb.Ado.SqlQuery<dynamic>("select * from task_flow_module where id in(@id)", p);
break; break;
} }
case 8:
{
//await serviceProvider.GetRequiredService<taskmana>
var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType);
await SetTaskBaseInfoPropertyWithBsno(taskId, taskTypeEnum, null, null, x => x.TASK_DESP == content);
break;
}
} }
return DataResult.Successed("测试成功"); return DataResult.Successed("测试成功");
} }
#region 任务台配置维护相关
/// <summary>
/// 获取任务是否生成配置列表
/// </summary>
public async Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList()
{
var type = typeof(TaskBaseTypeEnum);
List<TaskBaseTypeEnum> allServiceItemTask = Enum.GetValues(type)
.Cast<TaskBaseTypeEnum>()
.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<List<CreateTaskConfigDto>>.Success(result);
}
/// <summary>
/// 保存任务是否生成的配置
/// </summary>
/// <param name="taskTypeCode">任务类型编码</param>
/// <param name="isCreate">是否生成任务</param>
public async Task<DataResult> 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<TaskFlowTypeConfig>()
.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<TaskFlowTypeConfig>().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
} }
/// <summary> /// <summary>

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 将任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

@ -233,9 +233,9 @@ public class TaskManageController : ApiController
/// 测试用 /// 测试用
/// </summary> /// </summary>
[HttpGet("TestTaskFlow")] [HttpGet("TestTaskFlow")]
public async Task<DataResult> TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId, [FromQuery] int testType) public async Task<DataResult> 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);
} }
/// <summary> /// <summary>
@ -246,4 +246,24 @@ public class TaskManageController : ApiController
{ {
return await taskManageService.PullTask(Ids); return await taskManageService.PullTask(Ids);
} }
/// <summary>
/// 获取任务是否生成配置列表
/// </summary>
[HttpGet("GetCreateTaskConfigList")]
public async Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList()
{
return await taskManageService.GetCreateTaskConfigList();
}
/// <summary>
/// 保存任务是否生成的配置
/// </summary>
/// <param name="taskTypeCode">任务类型编码</param>
/// <param name="isCreate">是否生成任务</param>
[HttpPost("SaveCreateTaskConfig")]
public async Task<DataResult> SaveCreateTaskConfig([FromForm] string taskTypeCode, [FromForm] bool isCreate)
{
return await taskManageService.SaveCreateTaskConfig(taskTypeCode, isCreate);
}
} }

@ -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}" /> layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 --> <!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" /> <target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</targets> </targets>
<rules> <rules>
@ -28,6 +32,9 @@
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> --> <!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" /> <logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志--> <!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->

Loading…
Cancel
Save