接口:上传BC文件并触发执行BC任务

usertest
zhangxiaofeng 3 months ago
parent e7fb912abf
commit bc72cdcc39

@ -1519,6 +1519,9 @@ public static class MultiLanguageConst
[Description("任务主键{0} 附件下载请求失败,请确认文件是否存在")] [Description("任务主键{0} 附件下载请求失败,请确认文件是否存在")]
public const string TaskFileNotExists = "TaskFileNotExists"; public const string TaskFileNotExists = "TaskFileNotExists";
[Description("BC匹配订单失败")]
public const string BcMatchSeaExportFailed = "BcMatchSeaExportFailed";
#endregion #endregion
#region 邮件解析配置 #region 邮件解析配置

@ -11,7 +11,7 @@ namespace DS.Module.Core
/// 任务任务请求报文 /// 任务任务请求报文
/// </summary> /// </summary>
/// <remarks>类型DS.WMS.Core.TaskPlat.Dtos.TaskManageOrderMessageInfo</remarks> /// <remarks>类型DS.WMS.Core.TaskPlat.Dtos.TaskManageOrderMessageInfo</remarks>
public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo); public const string TaskManageOrderMessageInfo = "TaskManageOrderMessageInfo";
/// <summary> /// <summary>
/// 任务主表对象 /// 任务主表对象

@ -85,7 +85,7 @@ namespace DS.WMS.Core.TaskPlat.Dtos.Mapper
.Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate); .Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate);
} }
// BC子任务转前端Dto TaskManageOrderBCInfo, TaskBCInfo // BC子任务转前端Dto TaskBCShowBaseDto, TaskBCInfo
{ {
TypeAdapterConfig<TaskBCInfo, TaskBCShowBaseDto>.NewConfig().TwoWays() TypeAdapterConfig<TaskBCInfo, TaskBCShowBaseDto>.NewConfig().TwoWays()
.Map(dest => dest.Id, src => src.Id) .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.BATCH_NO, src => src.BatchNo)
.Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate); .Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate);
} }
// BC解析对象箱信息转成TaskBCCTNInfo
{
TypeAdapterConfig<ParserBCCTNInfoDto, TaskBCCTNInfo>.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);
}
} }
} }
} }

@ -2,6 +2,7 @@
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.DjyServiceStatus; using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Dtos;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -69,7 +70,14 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <summary> /// <summary>
/// 通过BC任务匹配订单任务台使用 /// 通过BC任务匹配订单任务台使用
/// </summary> /// </summary>
Task<DataResult<long?>> BcMatchSeaExportTask(TaskFlowDataContext dataContext); Task<DataResult<SeaExport?>> BcMatchSeaExportTask(TaskFlowDataContext dataContext);
/// <summary>
/// 上传BC文件并触发执行BC任务
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
Task<DataResult> UploadBcThenRunTask(string carrierCode, IFormFile file); Task<DataResult> UploadBcThenRunTask(string carrierCode, IFormFile file);
} }
} }

@ -64,6 +64,7 @@ namespace DS.WMS.Core.TaskPlat.Method
private Lazy<IBookingSlotService> bookingSlotService; private Lazy<IBookingSlotService> bookingSlotService;
private Lazy<ISeaExportService> seaExportService; private Lazy<ISeaExportService> seaExportService;
private Lazy<IDjyServiceStatusService> djyServiceStatusService; private Lazy<IDjyServiceStatusService> djyServiceStatusService;
private Lazy<ITaskAllocationService> taskAllocationService;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
@ -105,6 +106,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bookingSlotService = new Lazy<IBookingSlotService>(serviceProvider.GetRequiredService<IBookingSlotService>); bookingSlotService = new Lazy<IBookingSlotService>(serviceProvider.GetRequiredService<IBookingSlotService>);
seaExportService = new Lazy<ISeaExportService>(serviceProvider.GetRequiredService<ISeaExportService>); seaExportService = new Lazy<ISeaExportService>(serviceProvider.GetRequiredService<ISeaExportService>);
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>); djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>);
taskAllocationService = new Lazy<ITaskAllocationService>(serviceProvider.GetRequiredService<ITaskAllocationService>);
tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
tenantDb.QueryFilter.Clear<IOrgId>(); tenantDb.QueryFilter.Clear<IOrgId>();
@ -1334,31 +1336,67 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <summary> /// <summary>
/// 通过BC任务匹配订单任务台使用 /// 通过BC任务匹配订单任务台使用
/// </summary> /// </summary>
public async Task<DataResult<long?>> BcMatchSeaExportTask(TaskFlowDataContext dataContext) public async Task<DataResult<SeaExport?>> BcMatchSeaExportTask(TaskFlowDataContext dataContext)
{ {
var taskBcInfo = dataContext.Get<TaskBCInfo?>(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}"); var taskBcInfo = dataContext.Get<TaskBCInfo?>(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}");
var seaExportIdList = await tenantDb.Queryable<SeaExport>().Where(x => x.ParentId == 0 && (taskBcInfo.MBL_NO == x.MBLNO || taskBcInfo.MBL_NO == x.OrderNo)).Select(x => x.Id).ToListAsync(); var result = await BcMatchSeaExport(taskBcInfo);
logger.LogInformation($"通过BC任务匹配订单任务台使用根据taskBcInfo.MBL_NO【{taskBcInfo.MBL_NO}】查询订单seaExportIdList结果为{string.Join(',', seaExportIdList)}"); if (result.Succeeded && result.Data != null)
{
dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data!);
var seaExportId = seaExportIdList.FirstOrDefault(); await tenantDb.Updateable<TaskBCInfo>()
if (seaExportId != 0) .SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id)
.Where(x => x.Id == taskBcInfo.Id)
.ExecuteCommandAsync();
}
return result;
}
/// <summary>
/// 通过BC任务匹配订单
/// </summary>
private async Task<DataResult<SeaExport?>> BcMatchSeaExport(TaskBCInfo taskBcInfo)
{
List<SeaExport> seaExportList = new();
if (taskBcInfo.BOOKING_ORDER_ID == null || taskBcInfo.BOOKING_ORDER_ID == 0)
{ {
dataContext.Set(TaskFlowDataNameConst.BusinessId, seaExportId); seaExportList = await tenantDb.Queryable<SeaExport>()
taskBcInfo.BOOKING_ORDER_ID = seaExportId; .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<SeaExport>().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>(taskBcInfo).UpdateColumns(x => new var seaExport = seaExportList.FirstOrDefault();
if (seaExport != null)
{ {
x.BOOKING_ORDER_ID, taskBcInfo.BOOKING_ORDER_ID = seaExport.Id;
}).ExecuteCommandAsync();
return DataResult<long?>.Success("匹配成功", seaExportId, MultiLanguageConst.OperationSuccess); return DataResult<SeaExport?>.Success("匹配订单成功", seaExport, MultiLanguageConst.OperationSuccess);
} }
else else
{ {
return DataResult<long?>.Failed("匹配失败,未查询到订单", MultiLanguageConst.Operation_Failed); return DataResult<SeaExport?>.Failed("匹配订单失败", MultiLanguageConst.BcMatchSeaExportFailed);
} }
} }
#region 生成并推送邮件 #region 生成并推送邮件
/// <summary> /// <summary>
/// 生成并推送邮件 /// 生成并推送邮件
@ -2462,8 +2500,14 @@ namespace DS.WMS.Core.TaskPlat.Method
} }
#endregion #endregion
/// <summary>
/// 上传BC文件并触发执行BC任务
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
public async Task<DataResult> UploadBcThenRunTask([Required] string carrierCode, [Required] IFormFile file) public async Task<DataResult> UploadBcThenRunTask([Required] string carrierCode, [Required] IFormFile file)
{ {
return DataResult.Failed("开发中...", MultiLanguageConst.Operation_Failed);
/* /*
BCBC BCBC
@ -2481,13 +2525,28 @@ namespace DS.WMS.Core.TaskPlat.Method
logger.LogInformation("批次={no} 接收到上传BC请求", batchNo); logger.LogInformation("批次={no} 接收到上传BC请求", batchNo);
try
{
// 解析BC附件
var parserBcInfo = await GetReadBC(carrierCode, file); var parserBcInfo = await GetReadBC(carrierCode, file);
if (!parserBcInfo.Succeeded || parserBcInfo.Data == null) if (!parserBcInfo.Succeeded || parserBcInfo.Data == null)
{ {
return DataResult.Failed(parserBcInfo.Message); return DataResult.Failed(parserBcInfo.Message);
} }
// 解析出BC任务
var taskBcInfo = parserBcInfo.Adapt<TaskBCInfo>(); var taskBcInfo = parserBcInfo.Adapt<TaskBCInfo>();
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 var taskInfo = new TaskBaseInfo
{ {
Id = SnowFlakeSingle.Instance.NextId(), Id = SnowFlakeSingle.Instance.NextId(),
@ -2497,11 +2556,11 @@ namespace DS.WMS.Core.TaskPlat.Method
IS_COMPLETE = 0, IS_COMPLETE = 0,
MBL_NO = taskBcInfo.MBL_NO, MBL_NO = taskBcInfo.MBL_NO,
TASK_TYPE = TaskBaseTypeEnum.BC.ToString(), TASK_TYPE = TaskBaseTypeEnum.BC.ToString(),
TASK_TYPE_NAME = TaskBaseTypeEnum.BC.EnumDescription(),
//TASK_BASE_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 = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0,
IS_PUBLIC = 1, IS_PUBLIC = 1,
//BOOK_ORDER_NO = info.Main.BookingOrderNo,
//OUT_BUSI_NO = $"{info.Head.SenderId}_{info.Head.GID}", //OUT_BUSI_NO = $"{info.Head.SenderId}_{info.Head.GID}",
TASK_TITLE = $"手动上传-BC {taskBcInfo.VESSEL}/{taskBcInfo.VOYNO} ETD:{taskBcInfo.ETD} BLNo:{taskBcInfo.MBL_NO}", TASK_TITLE = $"手动上传-BC {taskBcInfo.VESSEL}/{taskBcInfo.VOYNO} ETD:{taskBcInfo.ETD} BLNo:{taskBcInfo.MBL_NO}",
//TASK_DESP = info.Main.TaskDesp, //TASK_DESP = info.Main.TaskDesp,
@ -2512,110 +2571,148 @@ namespace DS.WMS.Core.TaskPlat.Method
TASK_REQ_USERNAME = user.UserName, TASK_REQ_USERNAME = user.UserName,
YARD_NAME = taskBcInfo.YARD, YARD_NAME = taskBcInfo.YARD,
ETD = taskBcInfo.ETD, ETD = taskBcInfo.ETD,
//CUSTOMER_ID = ,
//CUSTOMER_NAME = ,
BATCH_STATIC = batchNo, BATCH_STATIC = batchNo,
//DJYUserId = info.Head.DJYUserId, //DJYUserId = info.Head.DJYUserId,
//OUT_BS_NO = ,
CreateTime = DateTime.Now, 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; taskInfo.TASK_DESP = taskInfo.TASK_TITLE;
if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp)) taskBcInfo.TASK_ID = taskInfo.Id;
// 构建箱信息
var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List<Code.Dtos.CodeCtnRes>();
var ctnList = parserBcInfo.Data.CtnList?.Select(ctn =>
{ {
taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription(); var bcCtnInfo = ctn.Adapt<TaskBCCTNInfo>();
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 : "";
} }
//// 如果船公司主键不为空则直接保存船公司主键、Code、Name等信息 bcCtnInfo.CreateBy = taskInfo.CreateBy;
//if (info.Main.CarrierPK != null) bcCtnInfo.CreateTime = taskInfo.CreateTime;
//{ return bcCtnInfo;
// taskInfo.CARRIER_ID = info.Main.CarrierPK; }).ToList();
// 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>();
// 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 创建人:谁创建的,只有一个人(可能是某个租户的管理员,因为任务可以由外部(邮件)创建,无法为每个人创建接口授权信息) TaskFlowDataContext allotDataContext = new TaskFlowDataContext((TaskFlowDataNameConst.Business, seaExport.Data));
//// TaskBaseInfo.TASK_REQ_USERID 制单人只有一个人使用任务创建报文中传入的TaskUserId var allotUserList = await taskAllocationService.Value.GetAllotUserBySeaExportId(TaskBaseTypeEnum.BC, seaExport.Data.Id, allotDataContext);
//// TaskBaseAllocation.UserId 任务关系任务属于谁谁能够查看并处理可能是多个人可能是多个人一起处理取值优先级info.Main.RecvUserInfoList>关联订单
//// TaskBaseInfo.RealUserId 实际操作人:谁实际处理的,只有一个人(但是工作流过来的任务会由多个人处理)
//// 创建人 // 保存BC文件
//taskInfo.CreateBy = long.Parse(user.UserId); string bcFileName = file.FileName;
//taskInfo.CreateUserName = user.UserName; 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擦写文件
//long taskReqUserId = 0; string bcNotifyFileName = file.FileName + "_MODIFY";
//if (!string.IsNullOrWhiteSpace(info.Main.TaskUserId)) var bcNotifyFileBytes = await GetModifyBCFile(carrierCode, file);
//{ if (!bcNotifyFileBytes.Succeeded || bcNotifyFileBytes.Data == null || bcNotifyFileBytes.Data.Length == 0)
// if (long.TryParse(info.Main.TaskUserId, out taskReqUserId)) {
// { return DataResult.Failed(bcNotifyFileBytes.Message);
// taskInfo.TASK_REQ_USERID = taskReqUserId; }
// taskInfo.TASK_REQ_USERNAME = info.Main.TaskUserName; 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();
// var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List<Code.Dtos.CodeCtnRes>(); if (allotUserList.Succeeded && allotUserList.Data?.Count > 0)
// var ctnList = info.Main.BCInfo.CtnList.Select(ctn => {
// { await SetTaskOwner([taskInfo.Id], allotUserList.Data);
// var bcCtnInfo = ctn.Adapt<TaskBCCTNInfo>(); }
// bcCtnInfo.Id = SnowFlakeSingle.Instance.NextId();
// bcCtnInfo.P_ID = bcInfo.Id;
// if (string.IsNullOrEmpty(bcCtnInfo.CTNCODE)) // 触发BC任务,执行自动化操作
// { TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt<TaskManageOrderBCInfo>();
// var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(bcCtnInfo.CTNALL, StringComparison.OrdinalIgnoreCase)); messageBcInfo.CtnList = ctnList.Adapt<List<TaskManageOrderBCCTNInfo>>();
// bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : ""; 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),
// bcInfo.CreateBy = taskInfo.CreateBy; // 邮件接收任务特有
// bcInfo.CreateTime = taskInfo.CreateTime; (TaskFlowDataNameConst.TaskManageOrderMessageInfo, messageInfo),
// 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任务任务对象存库文件信息存库 // BC任务特有
(TaskFlowDataNameConst.BCFile, file),
//(TaskFlowDataNameConst.AmendmentFile, modifyFile),
(TaskFlowDataNameConst.TaskBCInfo, taskBcInfo),
(TaskFlowDataNameConst.TaskBCCtnList, ctnList)
);
return default; TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider);
await taskFlow.Run(TaskBaseTypeEnum.BC, taskInfo.Id, dataContext);
}
catch (Exception ex)
{
return DataResult.Failed("操作失败!", MultiLanguageConst.Operation_Failed);
}
return DataResult.Successed("操作成功!", MultiLanguageConst.OperationSuccess);
} }
} }
} }

@ -931,8 +931,8 @@ namespace DS.WMS.Core.TaskPlat.Method
bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : ""; bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : "";
} }
bcInfo.CreateBy = taskInfo.CreateBy; bcCtnInfo.CreateBy = taskInfo.CreateBy;
bcInfo.CreateTime = taskInfo.CreateTime; bcCtnInfo.CreateTime = taskInfo.CreateTime;
return bcCtnInfo; return bcCtnInfo;
}).ToList(); }).ToList();
@ -956,7 +956,7 @@ namespace DS.WMS.Core.TaskPlat.Method
// 邮件接收任务特有 // 邮件接收任务特有
(TaskFlowDataNameConst.TaskManageOrderMessageInfo, info), (TaskFlowDataNameConst.TaskManageOrderMessageInfo, info),
// BC任务特有 // BC任务特有
(TaskFlowDataNameConst.BCFile, file), (TaskFlowDataNameConst.BCFile, file),
(TaskFlowDataNameConst.AmendmentFile, modifyFile), (TaskFlowDataNameConst.AmendmentFile, modifyFile),
(TaskFlowDataNameConst.TaskBCInfo, bcInfo), (TaskFlowDataNameConst.TaskBCInfo, bcInfo),

@ -101,13 +101,12 @@ namespace DS.WMS.TaskApi.Controllers
/// <summary> /// <summary>
/// 上传BC文件并触发执行BC任务 /// 上传BC文件并触发执行BC任务
/// </summary> /// </summary>
/// <param name="taskBaseId">任务主键</param>
/// <param name="carrierCode">船公司代码</param> /// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param> /// <param name="file">BC文件</param>
[HttpPost("UploadBcThenRunTask")] [HttpPost("UploadBcThenRunTask")]
public async Task<DataResult> UploadBcThenRunTask( [FromForm] string carrierCode, [FromForm] IFormFile file) public async Task<DataResult> UploadBcThenRunTask(string carrierCode, IFormFile file)
{ {
return await _taskManageBCService.UploadBcThenRunTask( carrierCode, file); return await _taskManageBCService.UploadBcThenRunTask(carrierCode, file);
} }
#endregion #endregion
} }

Loading…
Cancel
Save