zhangxiaofeng 11 months ago
commit 43e20c4d18

@ -16,6 +16,16 @@ namespace Myshipping.Application
/// BC-Booking Confirmation
/// </summary>
[Description("Booking Confirmation")]
BC
BC,
/// <summary>
/// BC-Booking Confirmation通知
/// </summary>
[Description("Booking Confirmation Notice")]
BC_NOTICE,
/// <summary>
/// 空
/// </summary>
[Description("NONE")]
NONE,
}
}

@ -36,8 +36,9 @@ namespace Myshipping.Application
/// 任务ID下载附件
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <param name="fileCategory">附件分类代码</param>
/// <returns>返回数据流</returns>
Task<IActionResult> DownloadFile(string taskPKId);
Task<IActionResult> DownloadFile(string taskPKId, string fileCategory = "BC");
/// <summary>
/// 检索订舱信息

@ -274,9 +274,10 @@ namespace Myshipping.Application
/// 创建BC任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="modifyFile">BC变更内容后文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, string jsonData);
Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, IFormFile modifyFile, string jsonData);
/// <summary>
/// 获取任务列表

@ -335,9 +335,10 @@ namespace Myshipping.Application
/// 任务ID下载附件
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <param name="fileCategory">附件分类代码</param>
/// <returns>返回数据流</returns>
[HttpGet("/TaskManageBC/DownloadFile")]
public async Task<IActionResult> DownloadFile(string taskPKId)
public async Task<IActionResult> DownloadFile([FromQuery] string taskPKId, [FromQuery] string fileCategory = "BC")
{
var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
if (bcTaskInfo == null)
@ -345,7 +346,18 @@ namespace Myshipping.Application
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
}
var fileInfo = await _taskFileRepository.AsQueryable().FirstAsync(u => u.TASK_PKID == taskPKId);
TaskFileCategoryEnum fileCategoryEnum = TaskFileCategoryEnum.NONE;
System.Enum.TryParse(fileCategory, out fileCategoryEnum);
if (fileCategoryEnum == TaskFileCategoryEnum.NONE)
{
throw Oops.Oh($"附件分类代码错误,请提供正确的分类代码");
}
string name = fileCategoryEnum.ToString();
var fileInfo = await _taskFileRepository.AsQueryable().FirstAsync(u => u.TASK_PKID == taskPKId && u.FILE_CATEGORY == name);
if (fileInfo == null)
{

@ -222,9 +222,10 @@ namespace Myshipping.Application
/// <param name="info">任务详情</param>
/// <param name="batchNo">批次号</param>
/// <param name="file">文件</param>
/// <param name="modifyFile">变更文件内容后的文件</param>
/// <returns>返回回执</returns>
[SqlSugarUnitOfWork]
private async Task<TaskManageOrderResultDto> InitTaskJob(TaskManageOrderMessageInfo info,string batchNo, IFormFile file = null)
private async Task<TaskManageOrderResultDto> InitTaskJob(TaskManageOrderMessageInfo info,string batchNo, IFormFile file = null, IFormFile modifyFile = null)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -339,8 +340,13 @@ namespace Myshipping.Application
{
var bytes = file.ToByteArray();
string attachFileType = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
attachFileType = "bcfiles";
var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, file.FileName,
GetFileType(file.FileName), "bcfiles");
GetFileType(file.FileName), attachFileType);
if (!string.IsNullOrWhiteSpace(fileFullName))
{
@ -359,6 +365,35 @@ namespace Myshipping.Application
}
}
if (modifyFile != null)
{
var bytes = modifyFile.ToByteArray();
string attachFileType = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
attachFileType = "bcnoticefiles";
var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, modifyFile.FileName,
GetFileType(modifyFile.FileName), attachFileType);
if (!string.IsNullOrWhiteSpace(fileFullName))
{
if (info.Main.FileList == null)
{
info.Main.FileList = new List<TaskManageOrderFileInfo>();
}
info.Main.FileList.Add(new TaskManageOrderFileInfo
{
PKId = IDGen.NextID().ToString(),
FileName = modifyFile.FileName,
FileType = Path.GetExtension(modifyFile.FileName).ToLower(),
FilePath = fileFullName
});
}
}
#region 附件
//附件
if (info.Main.FileList != null && info.Main.FileList.Count > 0)
@ -4974,10 +5009,11 @@ namespace Myshipping.Application
/// 创建BC任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="modifyFile">BC变更内容后文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateBCTaskJob")]
public async Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, [FromForm] string jsonData)
[AllowAnonymous, HttpPost("/TaskManage/CreateBCTaskJob"), ApiUser(ApiCode = "BCTaskManage")]
public async Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -4993,7 +5029,7 @@ namespace Myshipping.Application
if(info == null)
throw Oops.Bah("jsonData请求内容错误无法反序列化报文");
result = await InitTaskJob(info, batchNo, file);
result = await InitTaskJob(info, batchNo, file, modifyFile);
}
catch (Exception ex)
{

Loading…
Cancel
Save