From bc72cdcc395c6720b7213798d0c631f1ae727037 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Wed, 21 Aug 2024 16:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9A=E4=B8=8A=E4=BC=A0BC?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=B9=B6=E8=A7=A6=E5=8F=91=E6=89=A7=E8=A1=8C?= =?UTF-8?q?BC=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 3 + .../Constants/TaskFlowDataNameConst.cs | 2 +- .../Dtos/Mapper/AddTaskPlatMapsterSetup.cs | 18 +- .../Interface/ITaskManageBCService.cs | 10 +- .../TaskPlat/Method/TaskManageBCService.cs | 383 +++++++++++------- .../TaskPlat/Method/TaskManageService.cs | 6 +- .../Controllers/TaskManageBCController.cs | 5 +- 7 files changed, 275 insertions(+), 152 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 0b570937..1af87bf7 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1519,6 +1519,9 @@ public static class MultiLanguageConst [Description("任务主键{0} 附件下载请求失败,请确认文件是否存在")] public const string TaskFileNotExists = "TaskFileNotExists"; + + [Description("BC匹配订单失败")] + public const string BcMatchSeaExportFailed = "BcMatchSeaExportFailed"; #endregion #region 邮件解析配置 diff --git a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs index 87de2130..f19a0df2 100644 --- a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs @@ -11,7 +11,7 @@ namespace DS.Module.Core /// 任务任务请求报文 /// /// 类型:DS.WMS.Core.TaskPlat.Dtos.TaskManageOrderMessageInfo - public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo); + public const string TaskManageOrderMessageInfo = "TaskManageOrderMessageInfo"; /// /// 任务主表对象 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs index 247867ab..60220711 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/Mapper/AddTaskPlatMapsterSetup.cs @@ -85,7 +85,7 @@ namespace DS.WMS.Core.TaskPlat.Dtos.Mapper .Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate); } - // BC子任务转前端Dto TaskManageOrderBCInfo, TaskBCInfo + // BC子任务转前端Dto TaskBCShowBaseDto, TaskBCInfo { TypeAdapterConfig.NewConfig().TwoWays() .Map(dest => dest.Id, src => src.Id) @@ -785,6 +785,22 @@ namespace DS.WMS.Core.TaskPlat.Dtos.Mapper .Map(dest => dest.BATCH_NO, src => src.BatchNo) .Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate); } + + // BC解析对象箱信息转成TaskBCCTNInfo + { + TypeAdapterConfig.NewConfig() + //.Map(dest => dest.CTNCODE, src => src.CtnCode) + .Map(dest => dest.CTNALL, src => src.CtnALL) + .Map(dest => dest.CTNNUM, src => src.CtnNum) + .Map(dest => dest.IODGT, src => src.IODGT) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.RETURN_CTN_YARD, src => src.ReturnCTNYard) + .Map(dest => dest.SPECIAL_LOADING_REQUIRE, src => src.SpecialLoadingRequire) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.TAKE_CTN_TIME, src => src.TakeCTNTime) + .Map(dest => dest.TAKE_CTN_YARD, src => src.TakeCTNYard) + .Map(dest => dest.TAREWEIGHT, src => src.TareWeight); + } } } } 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 c5dd6797..311fd8d7 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs @@ -2,6 +2,7 @@ using DS.Module.Core.Data; using DS.Module.DjyServiceStatus; using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.TaskPlat.Dtos; using Microsoft.AspNetCore.Http; using System.Threading.Tasks; @@ -69,7 +70,14 @@ namespace DS.WMS.Core.TaskPlat.Interface /// /// 通过BC任务匹配订单(任务台使用) /// - Task> BcMatchSeaExportTask(TaskFlowDataContext dataContext); + Task> BcMatchSeaExportTask(TaskFlowDataContext dataContext); + + + /// + /// 上传BC文件并触发执行BC任务 + /// + /// 船公司代码 + /// BC文件 Task UploadBcThenRunTask(string carrierCode, IFormFile file); } } 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 77ec8af1..ba672ead 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -64,6 +64,7 @@ namespace DS.WMS.Core.TaskPlat.Method private Lazy bookingSlotService; private Lazy seaExportService; private Lazy djyServiceStatusService; + private Lazy taskAllocationService; private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); @@ -105,6 +106,7 @@ namespace DS.WMS.Core.TaskPlat.Method bookingSlotService = new Lazy(serviceProvider.GetRequiredService); seaExportService = new Lazy(serviceProvider.GetRequiredService); djyServiceStatusService = new Lazy(serviceProvider.GetRequiredService); + taskAllocationService = new Lazy(serviceProvider.GetRequiredService); tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); tenantDb.QueryFilter.Clear(); @@ -1334,31 +1336,67 @@ namespace DS.WMS.Core.TaskPlat.Method /// /// 通过BC任务匹配订单(任务台使用) /// - public async Task> BcMatchSeaExportTask(TaskFlowDataContext dataContext) + public async Task> BcMatchSeaExportTask(TaskFlowDataContext dataContext) { var taskBcInfo = dataContext.Get(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}"); - var seaExportIdList = await tenantDb.Queryable().Where(x => x.ParentId == 0 && (taskBcInfo.MBL_NO == x.MBLNO || taskBcInfo.MBL_NO == x.OrderNo)).Select(x => x.Id).ToListAsync(); - logger.LogInformation($"通过BC任务匹配订单(任务台使用):根据taskBcInfo.MBL_NO【{taskBcInfo.MBL_NO}】查询订单,seaExportIdList结果为:{string.Join(',', seaExportIdList)}"); + var result = await BcMatchSeaExport(taskBcInfo); + if (result.Succeeded && result.Data != null) + { + dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data!); - var seaExportId = seaExportIdList.FirstOrDefault(); - if (seaExportId != 0) + await tenantDb.Updateable() + .SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id) + .Where(x => x.Id == taskBcInfo.Id) + .ExecuteCommandAsync(); + } + return result; + } + /// + /// 通过BC任务匹配订单 + /// + private async Task> BcMatchSeaExport(TaskBCInfo taskBcInfo) + { + List seaExportList = new(); + if (taskBcInfo.BOOKING_ORDER_ID == null || taskBcInfo.BOOKING_ORDER_ID == 0) { - dataContext.Set(TaskFlowDataNameConst.BusinessId, seaExportId); - taskBcInfo.BOOKING_ORDER_ID = seaExportId; + seaExportList = await tenantDb.Queryable() + .Where(x => x.ParentId == 0 && (taskBcInfo.MBL_NO == x.MBLNO || taskBcInfo.MBL_NO == x.BookingNo)) + .Select(x => new SeaExport() + { + Id = x.Id, + MBLNO = x.MBLNO, + OperatorId = x.OperatorId, + OperatorName = x.OperatorName, + Doc = x.Doc, + DocName = x.DocName, + SaleId = x.SaleId, + Sale = x.Sale, + CustomerService = x.CustomerService, + CustomerServiceName = x.CustomerServiceName, + ForeignCustomerService = x.ForeignCustomerService, + ForeignCustomerServiceName = x.ForeignCustomerServiceName + }).ToListAsync(); + } + else + { + seaExportList = await tenantDb.Queryable().Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID).ToListAsync(); + } + logger.LogInformation($"通过BC任务匹配订单(任务台使用):根据taskBcInfo.MBL_NO【{taskBcInfo.MBL_NO}】查询订单后,seaExportList结果为:{JsonConvert.SerializeObject(seaExportList)}"); - await tenantDb.Updateable(taskBcInfo).UpdateColumns(x => new - { - x.BOOKING_ORDER_ID, - }).ExecuteCommandAsync(); + var seaExport = seaExportList.FirstOrDefault(); + if (seaExport != null) + { + taskBcInfo.BOOKING_ORDER_ID = seaExport.Id; - return DataResult.Success("匹配成功", seaExportId, MultiLanguageConst.OperationSuccess); + return DataResult.Success("匹配订单成功", seaExport, MultiLanguageConst.OperationSuccess); } else { - return DataResult.Failed("匹配失败,未查询到订单", MultiLanguageConst.Operation_Failed); + return DataResult.Failed("匹配订单失败", MultiLanguageConst.BcMatchSeaExportFailed); } } + #region 生成并推送邮件 /// /// 生成并推送邮件 @@ -2462,8 +2500,14 @@ namespace DS.WMS.Core.TaskPlat.Method } #endregion + /// + /// 上传BC文件并触发执行BC任务 + /// + /// 船公司代码 + /// BC文件 public async Task UploadBcThenRunTask([Required] string carrierCode, [Required] IFormFile file) { + return DataResult.Failed("开发中...", MultiLanguageConst.Operation_Failed); /* 解析BC附件,生成BC任务 生成擦写后的文件 @@ -2481,141 +2525,194 @@ namespace DS.WMS.Core.TaskPlat.Method logger.LogInformation("批次={no} 接收到上传BC请求", batchNo); - var parserBcInfo = await GetReadBC(carrierCode, file); - if (!parserBcInfo.Succeeded || parserBcInfo.Data == null) + try { - return DataResult.Failed(parserBcInfo.Message); - } - var taskBcInfo = parserBcInfo.Adapt(); - var taskInfo = new TaskBaseInfo - { - Id = SnowFlakeSingle.Instance.NextId(), - STATUS = TaskStatusEnum.Create.ToString(), - STATUS_NAME = TaskStatusEnum.Create.EnumDescription(), - IS_EXCEPT = 0, - IS_COMPLETE = 0, - MBL_NO = taskBcInfo.MBL_NO, - TASK_TYPE = TaskBaseTypeEnum.BC.ToString(), - //TASK_BASE_TYPE = info.Main.TaskType.ToString(), - //CARRIER_ID = info.Main.CarrierId?.Trim(), - //IS_PUBLIC = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0, - IS_PUBLIC = 1, - //BOOK_ORDER_NO = info.Main.BookingOrderNo, - //OUT_BUSI_NO = $"{info.Head.SenderId}_{info.Head.GID}", - TASK_TITLE = $"手动上传-BC {taskBcInfo.VESSEL}/{taskBcInfo.VOYNO} ETD:{taskBcInfo.ETD} BLNo:{taskBcInfo.MBL_NO}", - //TASK_DESP = info.Main.TaskDesp, - TASK_SOURCE = "ManualUploadBC", - TASK_SOURCE_NAME = "手动上传BC", - VESSEL_VOYNO = $"{taskBcInfo.VESSEL}/{taskBcInfo.VOYNO}"?.Trim(), - CONTA_INFO = taskBcInfo.CTN_STAT, - TASK_REQ_USERNAME = user.UserName, - YARD_NAME = taskBcInfo.YARD, - ETD = taskBcInfo.ETD, - //CUSTOMER_ID = , - //CUSTOMER_NAME = , - BATCH_STATIC = batchNo, - //DJYUserId = info.Head.DJYUserId, - //OUT_BS_NO = , - CreateTime = DateTime.Now, - }; - taskInfo.TASK_DESP = taskInfo.TASK_TITLE; + // 解析BC附件 + var parserBcInfo = await GetReadBC(carrierCode, file); + if (!parserBcInfo.Succeeded || parserBcInfo.Data == null) + { + return DataResult.Failed(parserBcInfo.Message); + } + + // 解析出BC任务 + var taskBcInfo = parserBcInfo.Adapt(); + taskBcInfo.Id = SnowFlakeSingle.Instance.NextId(); + + // 获取订单信息 + var seaExport = await BcMatchSeaExport(taskBcInfo); + if (!seaExport.Succeeded || seaExport.Data == null) + { + return DataResult.Failed(seaExport.Message); + } + + // 构建Base任务 + var taskInfo = new TaskBaseInfo + { + Id = SnowFlakeSingle.Instance.NextId(), + STATUS = TaskStatusEnum.Create.ToString(), + STATUS_NAME = TaskStatusEnum.Create.EnumDescription(), + IS_EXCEPT = 0, + IS_COMPLETE = 0, + MBL_NO = taskBcInfo.MBL_NO, + TASK_TYPE = TaskBaseTypeEnum.BC.ToString(), + TASK_TYPE_NAME = TaskBaseTypeEnum.BC.EnumDescription(), + //TASK_BASE_TYPE = info.Main.TaskType.ToString(), + //CARRIER_ID = info.Main.CarrierId?.Trim(), + //IS_PUBLIC = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0, + IS_PUBLIC = 1, + //OUT_BUSI_NO = $"{info.Head.SenderId}_{info.Head.GID}", + TASK_TITLE = $"手动上传-BC {taskBcInfo.VESSEL}/{taskBcInfo.VOYNO} ETD:{taskBcInfo.ETD} BLNo:{taskBcInfo.MBL_NO}", + //TASK_DESP = info.Main.TaskDesp, + TASK_SOURCE = "ManualUploadBC", + TASK_SOURCE_NAME = "手动上传BC", + VESSEL_VOYNO = $"{taskBcInfo.VESSEL}/{taskBcInfo.VOYNO}"?.Trim(), + CONTA_INFO = taskBcInfo.CTN_STAT, + TASK_REQ_USERNAME = user.UserName, + YARD_NAME = taskBcInfo.YARD, + ETD = taskBcInfo.ETD, + BATCH_STATIC = batchNo, + //DJYUserId = info.Head.DJYUserId, + CreateTime = DateTime.Now, + CreateBy = long.Parse(user.UserId), + CreateUserName = user.UserName, + + OUT_BS_NO = seaExport.Data.Id, + BOOK_ORDER_NO = seaExport.Data.Id.ToString(), + CARRIER_ID = seaExport.Data.CarrierId, + CARRIER_NAME = seaExport.Data.Carrier, + CUSTOMER_ID = seaExport.Data.CustomerId, + CUSTOMER_NAME = seaExport.Data.CustomerName, + }; + taskInfo.TASK_DESP = taskInfo.TASK_TITLE; + + taskBcInfo.TASK_ID = taskInfo.Id; - if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp)) + // 构建箱信息 + var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List(); + var ctnList = parserBcInfo.Data.CtnList?.Select(ctn => + { + var bcCtnInfo = ctn.Adapt(); + bcCtnInfo.Id = SnowFlakeSingle.Instance.NextId(); + bcCtnInfo.P_ID = taskBcInfo.Id; + + if (string.IsNullOrEmpty(bcCtnInfo.CTNCODE)) + { + var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(bcCtnInfo.CTNALL, StringComparison.OrdinalIgnoreCase)); + + bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : ""; + } + + bcCtnInfo.CreateBy = taskInfo.CreateBy; + bcCtnInfo.CreateTime = taskInfo.CreateTime; + return bcCtnInfo; + }).ToList(); + + // 获取任务分配关系 + TaskFlowDataContext allotDataContext = new TaskFlowDataContext((TaskFlowDataNameConst.Business, seaExport.Data)); + var allotUserList = await taskAllocationService.Value.GetAllotUserBySeaExportId(TaskBaseTypeEnum.BC, seaExport.Data.Id, allotDataContext); + + // 保存BC文件 + string bcFileName = file.FileName; + var bcFileBytes = file.ToByteArray(); + var bcNoExtensionFileName = Path.GetFileNameWithoutExtension(file.FileName); + var bcFileFullName = await SaveFile(taskInfo.Id.ToString()!, + bcFileBytes, + batchNo, + bcNoExtensionFileName, + GetFileType(file.FileName), + "bcfiles"); + // 构建BC文件索引信息 + var bcFileInfo = new TaskFileInfo + { + Id = SnowFlakeSingle.Instance.NextId(), + TASK_PKID = taskInfo.Id, + CreateBy = taskInfo.CreateBy, + CreateTime = taskInfo.CreateTime, + FILE_PATH = bcFileFullName, + FILE_NAME = bcFileName, + FILE_TYPE = Path.GetExtension(bcFileName).ToLower(), + FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString(), + FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription() + }; + + // 保存BC擦写文件 + string bcNotifyFileName = file.FileName + "_MODIFY"; + var bcNotifyFileBytes = await GetModifyBCFile(carrierCode, file); + if (!bcNotifyFileBytes.Succeeded || bcNotifyFileBytes.Data == null || bcNotifyFileBytes.Data.Length == 0) + { + return DataResult.Failed(bcNotifyFileBytes.Message); + } + var bcNotifyNoExtensionFileName = Path.GetFileNameWithoutExtension(bcNotifyFileName); + var bcNotifyFileFullName = await SaveFile(taskInfo.Id.ToString()!, + bcNotifyFileBytes.Data, + batchNo, + bcNotifyNoExtensionFileName, + GetFileType(bcNotifyFileName), + "bcnoticefiles"); + // 构建BC文件擦写文件索引信息 + var bcNotifyFileInfo = new TaskFileInfo + { + Id = SnowFlakeSingle.Instance.NextId(), + TASK_PKID = taskInfo.Id, + CreateBy = taskInfo.CreateBy, + CreateTime = taskInfo.CreateTime, + FILE_PATH = bcNotifyFileFullName, + FILE_NAME = bcNotifyFileName, + FILE_TYPE = Path.GetExtension(bcNotifyFileName).ToLower(), + FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString(), + FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription() + }; + + // 存库 + await tenantDb.Insertable(taskInfo).ExecuteCommandAsync(); + await tenantDb.Insertable(taskBcInfo).ExecuteCommandAsync(); + await tenantDb.Insertable(ctnList).ExecuteCommandAsync(); + + if (allotUserList.Succeeded && allotUserList.Data?.Count > 0) + { + await SetTaskOwner([taskInfo.Id], allotUserList.Data); + } + + // 触发BC任务,执行自动化操作 + TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt(); + messageBcInfo.CtnList = ctnList.Adapt>(); + + TaskManageOrderMessageInfo messageInfo = new TaskManageOrderMessageInfo() + { + Main = new TaskManageOrderMessageMainInfo() + { + BCInfo = messageBcInfo, + TaskType = TaskBaseTypeEnum.BC, + TaskBatchNo = batchNo, + }, + Head = new TaskManageOrderMessageHeadInfo() + { + RequestAction = "add" + } + }; + TaskFlowDataContext dataContext = new( + // 固定 + (TaskFlowDataNameConst.TaskBaseInfo, taskInfo), + + // 邮件接收任务特有 + (TaskFlowDataNameConst.TaskManageOrderMessageInfo, messageInfo), + + // BC任务特有 + (TaskFlowDataNameConst.BCFile, file), + //(TaskFlowDataNameConst.AmendmentFile, modifyFile), + (TaskFlowDataNameConst.TaskBCInfo, taskBcInfo), + (TaskFlowDataNameConst.TaskBCCtnList, ctnList) + ); + + TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider); + await taskFlow.Run(TaskBaseTypeEnum.BC, taskInfo.Id, dataContext); + } + catch (Exception ex) { - taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription(); + return DataResult.Failed("操作失败!", MultiLanguageConst.Operation_Failed); } - - //// 如果船公司主键不为空,则直接保存船公司主键、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 - //// TaskBaseAllocation.UserId 任务关系:任务属于谁,谁能够查看并处理,可能是多个人(可能是多个人一起处理);取值优先级:info.Main.RecvUserInfoList>关联订单 - //// TaskBaseInfo.RealUserId 实际操作人:谁实际处理的,只有一个人(但是工作流过来的任务会由多个人处理) - - //// 创建人 - //taskInfo.CreateBy = long.Parse(user.UserId); - //taskInfo.CreateUserName = user.UserName; - - //// 制单人 - //long taskReqUserId = 0; - //if (!string.IsNullOrWhiteSpace(info.Main.TaskUserId)) - //{ - // if (long.TryParse(info.Main.TaskUserId, out taskReqUserId)) - // { - // taskInfo.TASK_REQ_USERID = taskReqUserId; - // taskInfo.TASK_REQ_USERNAME = info.Main.TaskUserName; - // } - - - // var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List(); - // var ctnList = info.Main.BCInfo.CtnList.Select(ctn => - // { - // var bcCtnInfo = ctn.Adapt(); - // bcCtnInfo.Id = SnowFlakeSingle.Instance.NextId(); - // bcCtnInfo.P_ID = bcInfo.Id; - - // if (string.IsNullOrEmpty(bcCtnInfo.CTNCODE)) - // { - // var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(bcCtnInfo.CTNALL, StringComparison.OrdinalIgnoreCase)); - - // bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : ""; - // } - - // bcInfo.CreateBy = taskInfo.CreateBy; - // bcInfo.CreateTime = taskInfo.CreateTime; - // return bcCtnInfo; - // }).ToList(); - - // // 保存BC文件 - // string bcFileName = file.FileName; - // var bcFileBytes = file.ToByteArray(); - // var bcNoExtensionFileName = Path.GetFileNameWithoutExtension(file.FileName); - // var bcFileFullName = await SaveFile(taskBaseId.ToString()!, - // bcFileBytes, - // batchNo, - // bcNoExtensionFileName, - // GetFileType(file.FileName), - // "bcfiles"); - - // // 保存BC擦写文件 - // string bcNotifyFileName = file.FileName + "_MODIFY"; - // var bcNotifyFileBytes = await GetModifyBCFile(carrierCode, file); - // if (!bcNotifyFileBytes.Succeeded || bcNotifyFileBytes.Data == null || bcNotifyFileBytes.Data.Length == 0) - // { - // return DataResult.Failed(bcNotifyFileBytes.Message); - // } - // var bcNotifyNoExtensionFileName = Path.GetFileNameWithoutExtension(bcNotifyFileName); - // var bcNotifyFileFullName = await SaveFile(taskBaseId.ToString()!, - // bcNotifyFileBytes.Data, - // batchNo, - // bcNotifyNoExtensionFileName, - // GetFileType(bcNotifyFileName), - // "bcnoticefiles"); - - // // 解析BC附件,生成BC任务,任务对象存库,文件信息存库 - - return default; + return DataResult.Successed("操作成功!", MultiLanguageConst.OperationSuccess); } } } 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 090ccc6d..06aaf136 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -931,8 +931,8 @@ namespace DS.WMS.Core.TaskPlat.Method bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : ""; } - bcInfo.CreateBy = taskInfo.CreateBy; - bcInfo.CreateTime = taskInfo.CreateTime; + bcCtnInfo.CreateBy = taskInfo.CreateBy; + bcCtnInfo.CreateTime = taskInfo.CreateTime; return bcCtnInfo; }).ToList(); @@ -956,7 +956,7 @@ namespace DS.WMS.Core.TaskPlat.Method // 邮件接收任务特有 (TaskFlowDataNameConst.TaskManageOrderMessageInfo, info), - // BC子任务特有 + // BC任务特有 (TaskFlowDataNameConst.BCFile, file), (TaskFlowDataNameConst.AmendmentFile, modifyFile), (TaskFlowDataNameConst.TaskBCInfo, bcInfo), diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs index 908ee4b8..92e366f0 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs @@ -101,13 +101,12 @@ namespace DS.WMS.TaskApi.Controllers /// /// 上传BC文件并触发执行BC任务 /// - /// 任务主键 /// 船公司代码 /// BC文件 [HttpPost("UploadBcThenRunTask")] - public async Task UploadBcThenRunTask( [FromForm] string carrierCode, [FromForm] IFormFile file) + public async Task UploadBcThenRunTask(string carrierCode, IFormFile file) { - return await _taskManageBCService.UploadBcThenRunTask( carrierCode, file); + return await _taskManageBCService.UploadBcThenRunTask(carrierCode, file); } #endregion }