|
|
|
@ -64,6 +64,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
private Lazy<IBookingSlotService> bookingSlotService;
|
|
|
|
|
private Lazy<ISeaExportService> seaExportService;
|
|
|
|
|
private Lazy<IDjyServiceStatusService> djyServiceStatusService;
|
|
|
|
|
private Lazy<ITaskAllocationService> taskAllocationService;
|
|
|
|
|
|
|
|
|
|
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>);
|
|
|
|
|
seaExportService = new Lazy<ISeaExportService>(serviceProvider.GetRequiredService<ISeaExportService>);
|
|
|
|
|
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>);
|
|
|
|
|
taskAllocationService = new Lazy<ITaskAllocationService>(serviceProvider.GetRequiredService<ITaskAllocationService>);
|
|
|
|
|
|
|
|
|
|
tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
tenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
@ -1334,31 +1336,67 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过BC任务匹配订单(任务台使用)
|
|
|
|
|
/// </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 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();
|
|
|
|
|
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<TaskBCInfo>()
|
|
|
|
|
.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);
|
|
|
|
|
taskBcInfo.BOOKING_ORDER_ID = seaExportId;
|
|
|
|
|
seaExportList = await tenantDb.Queryable<SeaExport>()
|
|
|
|
|
.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,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
taskBcInfo.BOOKING_ORDER_ID = seaExport.Id;
|
|
|
|
|
|
|
|
|
|
return DataResult<long?>.Success("匹配成功", seaExportId, MultiLanguageConst.OperationSuccess);
|
|
|
|
|
return DataResult<SeaExport?>.Success("匹配订单成功", seaExport, MultiLanguageConst.OperationSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return DataResult<long?>.Failed("匹配失败,未查询到订单", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult<SeaExport?>.Failed("匹配订单失败", MultiLanguageConst.BcMatchSeaExportFailed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 生成并推送邮件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成并推送邮件
|
|
|
|
@ -2462,8 +2500,14 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
#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)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("开发中...", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
/*
|
|
|
|
|
解析BC附件,生成BC任务
|
|
|
|
|
生成擦写后的文件
|
|
|
|
@ -2481,13 +2525,28 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
logger.LogInformation("批次={no} 接收到上传BC请求", batchNo);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// 解析BC附件
|
|
|
|
|
var parserBcInfo = await GetReadBC(carrierCode, file);
|
|
|
|
|
if (!parserBcInfo.Succeeded || parserBcInfo.Data == null)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed(parserBcInfo.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 解析出BC任务
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Id = SnowFlakeSingle.Instance.NextId(),
|
|
|
|
@ -2497,11 +2556,11 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
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,
|
|
|
|
|
//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,
|
|
|
|
@ -2512,110 +2571,148 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
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,
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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等信息
|
|
|
|
|
//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>();
|
|
|
|
|
// 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;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
bcCtnInfo.CreateBy = taskInfo.CreateBy;
|
|
|
|
|
bcCtnInfo.CreateTime = taskInfo.CreateTime;
|
|
|
|
|
return bcCtnInfo;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
//// 人员字段说明:
|
|
|
|
|
//// TaskBaseInfo.CreateBy 创建人:谁创建的,只有一个人(可能是某个租户的管理员,因为任务可以由外部(邮件)创建,无法为每个人创建接口授权信息)
|
|
|
|
|
//// TaskBaseInfo.TASK_REQ_USERID 制单人:只有一个人,使用任务创建报文中传入的TaskUserId
|
|
|
|
|
//// TaskBaseAllocation.UserId 任务关系:任务属于谁,谁能够查看并处理,可能是多个人(可能是多个人一起处理);取值优先级:info.Main.RecvUserInfoList>关联订单
|
|
|
|
|
//// TaskBaseInfo.RealUserId 实际操作人:谁实际处理的,只有一个人(但是工作流过来的任务会由多个人处理)
|
|
|
|
|
// 获取任务分配关系
|
|
|
|
|
TaskFlowDataContext allotDataContext = new TaskFlowDataContext((TaskFlowDataNameConst.Business, seaExport.Data));
|
|
|
|
|
var allotUserList = await taskAllocationService.Value.GetAllotUserBySeaExportId(TaskBaseTypeEnum.BC, seaExport.Data.Id, allotDataContext);
|
|
|
|
|
|
|
|
|
|
//// 创建人
|
|
|
|
|
//taskInfo.CreateBy = long.Parse(user.UserId);
|
|
|
|
|
//taskInfo.CreateUserName = user.UserName;
|
|
|
|
|
// 保存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()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//// 制单人
|
|
|
|
|
//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;
|
|
|
|
|
// }
|
|
|
|
|
// 保存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();
|
|
|
|
|
|
|
|
|
|
// var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List<Code.Dtos.CodeCtnRes>();
|
|
|
|
|
// var ctnList = info.Main.BCInfo.CtnList.Select(ctn =>
|
|
|
|
|
// {
|
|
|
|
|
// var bcCtnInfo = ctn.Adapt<TaskBCCTNInfo>();
|
|
|
|
|
// bcCtnInfo.Id = SnowFlakeSingle.Instance.NextId();
|
|
|
|
|
// bcCtnInfo.P_ID = bcInfo.Id;
|
|
|
|
|
if (allotUserList.Succeeded && allotUserList.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
await SetTaskOwner([taskInfo.Id], allotUserList.Data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (string.IsNullOrEmpty(bcCtnInfo.CTNCODE))
|
|
|
|
|
// {
|
|
|
|
|
// var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(bcCtnInfo.CTNALL, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
// 触发BC任务,执行自动化操作
|
|
|
|
|
TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt<TaskManageOrderBCInfo>();
|
|
|
|
|
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;
|
|
|
|
|
// 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");
|
|
|
|
|
// 邮件接收任务特有
|
|
|
|
|
(TaskFlowDataNameConst.TaskManageOrderMessageInfo, messageInfo),
|
|
|
|
|
|
|
|
|
|
// // 解析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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|