diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs index dad81b61..e100cbff 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs @@ -18,24 +18,24 @@ public interface IClientCommonService /// 获取商品下拉列表-客户端 /// /// - public Task>> GetClientGoodsList(string code = ""); + public Task>> GetClientGoodsList(string code = ""); /// /// 根据id获取往来单位参数信息 /// /// /// - public Task>> GetClientParamListById(string id); + public Task>> GetClientParamListById(string id); /// /// 根据用户ids获取用户邮箱信息 /// /// /// - public Task>> GetUseEmailListByIds(long[] ids); + public Task>> GetUseEmailListByIds(long[] ids); /// /// 根据类型获取用户下拉列表 /// /// - public Task>> GetUserListByCode(string code = ""); + public Task>> GetUserListByCode(string code = ""); /// /// 获取工厂信息下拉列表 /// @@ -87,7 +87,7 @@ public interface IClientCommonService /// 根据类型获取往来单位下拉列表 /// /// - public DataResult> GetClientListByCode(string code =""); + public DataResult> GetClientListByCode(string code = ""); /// /// 获取所有往来单位下拉列表 /// @@ -312,7 +312,7 @@ public interface IClientCommonService /// /// /// - public DataResult GetUserQuerySet(string permissionId,int tagNo=0); + public DataResult GetUserQuerySet(string permissionId, int tagNo = 0); /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBaseAllocationDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBaseAllocationDto.cs index 20848a13..53cd2035 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBaseAllocationDto.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBaseAllocationDto.cs @@ -6,7 +6,7 @@ namespace DS.WMS.Core.TaskPlat.Dtos public class TaskAllocationtSetSaveDto { /// - /// 分配对象编码 Operator=操作 VouchingClerk=单证 Sale=销售 Custom=报关员 FinancialStaff=财务 CustomerService=客服 Driver=司机 Dispatcher=派车调度人员 + /// 分配对象编码 Operator=操作 VouchingClerk=单证 Sale=销售 CustomerService=客服 /// public string AllocationTargetCode { get; set; } @@ -32,6 +32,15 @@ namespace DS.WMS.Core.TaskPlat.Dtos } public class TaskAllocationtSetQueryListDto { + public List OperatorTaskTypeList { get; set; } + public List SaleTaskTypeList { get; set; } + public List VouchingClerkTaskTypeList { get; set; } + public List CustomerServiceTaskTypeList { get; set; } + + //public List CustomTaskTypeList { get; set; } + //public List FinancialStaffTaskTypeList { get; set; } + //public List DriverTaskTypeList { get; set; } + //public List DispatcherTaskTypeList { get; set; } ///// ///// 船公司ID ///// @@ -46,14 +55,6 @@ namespace DS.WMS.Core.TaskPlat.Dtos ///// 船公司 ///// //public string? Carrier { get; set; } - public List OperatorTaskTypeList { get; set; } - public List VouchingClerkTaskTypeList { get; set; } - public List SaleTaskTypeList { get; set; } - public List CustomTaskTypeList { get; set; } - public List FinancialStaffTaskTypeList { get; set; } - public List CustomerServiceTaskTypeList { get; set; } - public List DriverTaskTypeList { get; set; } - public List DispatcherTaskTypeList { get; set; } } public class TaskAllocationtSetDto diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs index f1362f25..c69620b1 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -24,9 +24,19 @@ namespace DS.WMS.Core.TaskPlat.Dtos public TaskSourceEnum TaskSource { get; set; } /// - /// 船公司代号 + /// 船公司代号(列如:MSK)(邮件解析通过此参数传入船公司Id) /// - public string CarrierId { get; set; } + public string? CarrierId { get; set; } + + /// + /// 船公司主键(列如:1802321321421232132) + /// + public long? CarrierPK { get; set; } + + /// + /// 船公司名称(列如:马士基) + /// + public string? CarrierName { get; set; } /// /// 任务标题 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs index 069f3d48..5de08042 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs @@ -90,10 +90,20 @@ namespace DS.WMS.Core.TaskPlat.Entity //public string? TASK_BASE_TYPE { get; set; } /// - /// 船公司代号 + /// 船公司Id /// - [SugarColumn(ColumnDescription = "船公司代号", IsNullable = true, Length = 20)] - public string? CARRIER_ID { get; set; } + [SugarColumn(ColumnDescription = "船公司Id", IsNullable = true)] + public long? CARRIER_ID { get; set; } + /// + /// 船公司编码 + /// + [SugarColumn(ColumnDescription = "船公司编码", IsNullable = true, Length = 20)] + public string? CARRIER_CODE { get; set; } + /// + /// 船公司名称 + /// + [SugarColumn(ColumnDescription = "船公司名称", IsNullable = true, Length = 20)] + public string? CARRIER_NAME { get; set; } /// /// 主单号 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBaseService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBaseService.cs index 4e4c13f8..80f2eac2 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBaseService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBaseService.cs @@ -30,6 +30,12 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 任务Id /// 附件分类代码 Task<(string fileFullPath, string fileName)> GetTaskFileInfo(long taskId, string fileCategory); - Task> MatchTask(List? taskIdList); + + /// + /// 根据订单及配置,将所有或指定的公共任务匹配到个人 + /// + /// 任务Id列表(当传入时,则只匹配列表中指定的任务) + /// 涉及当前登陆人的匹配结果 + Task> MatchTask(List? taskIdList = null); } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs index e2b54b5d..5539c65e 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs @@ -209,7 +209,7 @@ namespace DS.WMS.Core.TaskPlat.Method { if (isLoad) { - await sysCacheService.SetCommonCode(JsonConvert.SerializeObject(list), Sys.Method.SysCacheCategoryEnum.TaskAllocationtSet, "DS8"); + await sysCacheService.SetCommonCode(list, Sys.Method.SysCacheCategoryEnum.TaskAllocationtSet, "DS8"); } return DataResult>.Success(list); 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 599e189a..a407d6ca 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -1395,7 +1395,7 @@ namespace DS.WMS.Core.TaskPlat.Method else if (bcTaskInfo.TASK_TYPE == TaskBaseTypeEnum.BC_MODIFY.ToString()) { //CMA没有变更附件,所以转发邮件时默认用原文件转发 - if (bcTaskInfo.CARRIER_ID.Equals("CMA", StringComparison.OrdinalIgnoreCase)) + if (bcTaskInfo.CARRIER_CODE.Equals("CMA", StringComparison.OrdinalIgnoreCase)) { fileInfo = tenantDb.Queryable().Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_MODIFY")) .OrderByDescending(a => a.CreateTime).First(); 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 898c35e3..433f84f9 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs @@ -315,7 +315,7 @@ namespace DS.WMS.Core.TaskPlat.Method /// /// 任务Id列表(当传入时,则只匹配列表中指定的任务) /// 涉及当前登陆人的匹配结果 - public async Task> MatchTask(List? taskIdList) + public async Task> MatchTask(List? taskIdList = null) { MatchTaskResultDto result = new MatchTaskResultDto(); @@ -343,7 +343,7 @@ namespace DS.WMS.Core.TaskPlat.Method } // 需要查询的订单的提单号的集合,用于一次性将需要查询的订单查询出来; - List waitQuerySeaExportWithMblnoList = new(); + HashSet waitQuerySeaExportWithMblnoList = new(); // 后续如果需要查询舱位,可以再补充字段如List waitQuerySlotWithMblnoList = new(); @@ -352,7 +352,7 @@ namespace DS.WMS.Core.TaskPlat.Method foreach (var item in taskList) { // 查找配置规则 - var targetAllotSet = allotSetList.Data.Where(x => x.TaskTypeCode == item.TASK_TYPE && x.CarrierCode == item.CARRIER_ID).OrderBy(x => x.Id).FirstOrDefault(); + var targetAllotSet = allotSetList.Data.Where(x => x.TaskTypeCode == item.TASK_TYPE && x.CarrierId == item.CARRIER_ID).OrderBy(x => x.Id).FirstOrDefault(); if (targetAllotSet == null) { targetAllotSet = allotSetList.Data.Where(x => x.TaskTypeCode == item.TASK_TYPE).OrderBy(x => x.Id).FirstOrDefault(); 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 7a3a7292..d2e7bd6a 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -32,6 +32,7 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ICodeCtnService codeCtnService; private readonly ICodePortService codePortService; private readonly IMappingPortService mappingPortService; + private readonly IMappingCarrierService mappingCarrierService; // 按需构建 @@ -42,11 +43,13 @@ namespace DS.WMS.Core.TaskPlat.Method IWebHostEnvironment environment, ICodeCtnService codeCtnService, ICodePortService codePortService, - IMappingPortService mappingPortService) : base(user, logger, saasDbService, serviceProvider, environment) + IMappingPortService mappingPortService, + IMappingCarrierService mappingCarrierService) : base(user, logger, saasDbService, serviceProvider, environment) { this.codeCtnService = codeCtnService; this.codePortService = codePortService; this.mappingPortService = mappingPortService; + this.mappingCarrierService = mappingCarrierService; } #region 对工作流提供的接口 @@ -285,7 +288,7 @@ namespace DS.WMS.Core.TaskPlat.Method MBL_NO = info.Main.MBlNo, TASK_TYPE = info.Main.TaskType.ToString(), //TASK_BASE_TYPE = info.Main.TaskType.ToString(), - CARRIER_ID = info.Main.CarrierId?.Trim(), + //CARRIER_ID = info.Main.CarrierId?.Trim(), //IS_PUBLIC = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0, IS_PUBLIC = 1, BOOK_ORDER_NO = info.Main.BookingOrderNo, @@ -311,6 +314,27 @@ namespace DS.WMS.Core.TaskPlat.Method taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription(); } + // 如果船公司主键不为空,则直接保存船公司主键、Code、Name等信息 + if (info.Main.CarrierPK != null) + { + taskInfo.CARRIER_ID = info.Main.CarrierPK; + taskInfo.CARRIER_CODE = info.Main.CarrierId; + taskInfo.CARRIER_NAME = info.Main.CarrierName; + } + // 如果船公司主键为空,但是Code不为空,则通过映射查出船公司信息并保存 + else if (!string.IsNullOrEmpty(info.Main.CarrierId)) + { + // 船公司转换 + var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List(); + MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(info.Main.CarrierId, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault(); + if (carrierInfo != null) + { + taskInfo.CARRIER_ID = carrierInfo.LinkId; + taskInfo.CARRIER_CODE = carrierInfo.MapCode; + taskInfo.CARRIER_NAME = carrierInfo.MapName; + } + } + // 人员字段说明: // TaskBaseInfo.CreateBy 创建人:谁创建的,只有一个人(可能是某个租户的管理员,因为任务可以由外部(邮件)创建,无法为每个人创建接口授权信息) // TaskBaseInfo.TASK_REQ_USERID 制单人:只有一个人,使用任务创建报文中传入的TaskUserId @@ -2126,6 +2150,8 @@ namespace DS.WMS.Core.TaskPlat.Method var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + //await MatchTask(); + var userId = long.Parse(user.UserId); //任务列表分组统计 var groupList = await tenantDb.Queryable() diff --git a/ds-wms-service/DS.WMS.TaskApi/appsettings.json b/ds-wms-service/DS.WMS.TaskApi/appsettings.json index 1a557719..65aa6077 100644 --- a/ds-wms-service/DS.WMS.TaskApi/appsettings.json +++ b/ds-wms-service/DS.WMS.TaskApi/appsettings.json @@ -84,5 +84,8 @@ "Url": "http://47.104.73.97:7115/api/TaskDraftCompare/ExcuteDraftCompare", "ResultUrl": "http://47.104.73.97:7115/api/TaskDraftCompare/DraftCompareResult", "ReadUrl": "http://47.104.73.97:7115/api/TaskDraftCompare/ExcuteDraftFileRead" + }, + "RedisInfo": { + "RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15" } }