|
|
|
@ -8,6 +8,7 @@ using ICSharpCode.SharpZipLib.Zip;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Application.Entity.TaskManagePlat;
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
@ -18,6 +19,7 @@ using NPOI.OpenXmlFormats.Dml.Diagram;
|
|
|
|
|
using RabbitMQ.Client;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
@ -39,7 +41,9 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BusinessCompareDiffRecord> _businessCompareDiffRecordRepository;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<TaskFileInfo> _taskFileRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingFileRepository;
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<TaskManageSISubmittedService> _logger;
|
|
|
|
|
private readonly IBookingValueAddedService _bookingValueAddedService;
|
|
|
|
|
private readonly IDjyTenantParamService _djyTenantParamService;
|
|
|
|
@ -55,6 +59,8 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<BusinessCompareDiffRecord> businessCompareDiffRecordRepository,
|
|
|
|
|
SqlSugarRepository<BookingCtn> bookingCtnRepository,
|
|
|
|
|
SqlSugarRepository<TaskSISubmittedCtn> taskSISubmittedCtnRepository,
|
|
|
|
|
SqlSugarRepository<TaskFileInfo> taskFileRepository,
|
|
|
|
|
SqlSugarRepository<BookingFile> bookingFileRepository,
|
|
|
|
|
IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService,
|
|
|
|
|
IBookingOrderService bookingOrderService)
|
|
|
|
|
{
|
|
|
|
@ -68,6 +74,9 @@ namespace Myshipping.Application
|
|
|
|
|
_bookingCtnRepository = bookingCtnRepository;
|
|
|
|
|
_taskSISubmittedCtnRepository = taskSISubmittedCtnRepository;
|
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
|
|
|
|
|
|
_taskFileRepository = taskFileRepository;
|
|
|
|
|
_bookingFileRepository = bookingFileRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取截单回执详情
|
|
|
|
@ -496,6 +505,10 @@ namespace Myshipping.Application
|
|
|
|
|
ctn.CreatedTime = DateTime.Now;
|
|
|
|
|
ctn.CreatedUserId = UserManager.UserId;
|
|
|
|
|
ctn.CreatedUserName = UserManager.Name;
|
|
|
|
|
ctn.KINDPKGS = x.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(x.KINDPKGS) && !string.IsNullOrWhiteSpace(siSubmitted.KINDPKGS))
|
|
|
|
|
ctn.KINDPKGS = siSubmitted.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
|
|
|
|
|
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
|
|
|
|
@ -521,6 +534,10 @@ namespace Myshipping.Application
|
|
|
|
|
ctn.CreatedTime = DateTime.Now;
|
|
|
|
|
ctn.CreatedUserId = UserManager.UserId;
|
|
|
|
|
ctn.CreatedUserName = UserManager.Name;
|
|
|
|
|
ctn.KINDPKGS = x.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(x.KINDPKGS) && !string.IsNullOrWhiteSpace(siSubmitted.KINDPKGS))
|
|
|
|
|
ctn.KINDPKGS = siSubmitted.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
|
|
|
|
|
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
|
|
|
|
@ -546,6 +563,10 @@ namespace Myshipping.Application
|
|
|
|
|
ctn.CreatedTime = DateTime.Now;
|
|
|
|
|
ctn.CreatedUserId = UserManager.UserId;
|
|
|
|
|
ctn.CreatedUserName = UserManager.Name;
|
|
|
|
|
ctn.KINDPKGS = x.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(x.KINDPKGS) && !string.IsNullOrWhiteSpace(siSubmitted.KINDPKGS))
|
|
|
|
|
ctn.KINDPKGS = siSubmitted.KINDPKGS;
|
|
|
|
|
|
|
|
|
|
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
|
|
|
|
|
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
|
|
|
|
@ -572,6 +593,8 @@ namespace Myshipping.Application
|
|
|
|
|
WEIGHKGS = x.WEIGHKGS,
|
|
|
|
|
CBM = x.CBM,
|
|
|
|
|
REMARK = "SI Add",
|
|
|
|
|
TAREWEIGHT = x.WEIGHKGS.HasValue && x.KGS.HasValue ? x.WEIGHKGS.Value - x.KGS.Value :0,
|
|
|
|
|
KINDPKGS = (string.IsNullOrWhiteSpace(x.KINDPKGS) && !string.IsNullOrWhiteSpace(siSubmitted.KINDPKGS))? siSubmitted.KINDPKGS: x.KINDPKGS,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -583,6 +606,29 @@ namespace Myshipping.Application
|
|
|
|
|
ctnList.ForEach(t => { if (t.REMARK.IndexOf("SI Add") < 0) ctnList.Remove(t); });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ctnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
bkModel.ctnInputs = ctnList.Select(t => new BookingCtnDto
|
|
|
|
|
{
|
|
|
|
|
BILLID = t.BILLID,
|
|
|
|
|
CNTRNO = t.CNTRNO,
|
|
|
|
|
CTNALL = t.CTNALL,
|
|
|
|
|
CTNCODE = t.CTNCODE,
|
|
|
|
|
CTNNUM = t.CTNNUM.HasValue ? t.CTNNUM.Value : 0,
|
|
|
|
|
CBM = t.CBM.HasValue ? t.CBM.Value : 0,
|
|
|
|
|
KINDPKGS = t.KINDPKGS,
|
|
|
|
|
PKGS = t.PKGS.HasValue ? t.PKGS.Value : 0,
|
|
|
|
|
SEALNO = t.SEALNO,
|
|
|
|
|
KGS = t.KGS.HasValue ? t.KGS.Value : 0,
|
|
|
|
|
TAREWEIGHT = t.TAREWEIGHT.HasValue ? t.TAREWEIGHT.Value : 0,
|
|
|
|
|
WEIGHKGS = t.WEIGHKGS.HasValue ? t.WEIGHKGS.Value : 0,
|
|
|
|
|
WEIGHTYPE = t.WEIGHTYPE,
|
|
|
|
|
|
|
|
|
|
Id = t.Id,
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新订舱数据
|
|
|
|
|
var bkRlt = await _bookingOrderService.Save(bkModel);
|
|
|
|
|
|
|
|
|
@ -669,6 +715,34 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//处理附件
|
|
|
|
|
var opt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
|
var dirAbs = opt.basePath;
|
|
|
|
|
if (string.IsNullOrEmpty(dirAbs))
|
|
|
|
|
{
|
|
|
|
|
dirAbs = App.WebHostEnvironment.WebRootPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
var fileList = _taskFileRepository.AsQueryable().Filter(null,true).Where(a => a.TASK_PKID == taskPkId && a.TenantId == taskBase.TenantId.Value).ToList();
|
|
|
|
|
|
|
|
|
|
fileList.ForEach(file =>
|
|
|
|
|
{
|
|
|
|
|
if (file.FILE_CATEGORY == TaskFileCategoryEnum.SI_SUBMITTED.ToString())
|
|
|
|
|
{
|
|
|
|
|
var fileFullPath = Path.Combine(dirAbs, file.FILE_PATH);
|
|
|
|
|
|
|
|
|
|
if (File.Exists(fileFullPath))
|
|
|
|
|
{
|
|
|
|
|
//如果确认文件读取成功
|
|
|
|
|
var bookFilePath = FileAttachHelper.MoveFile(bkRlt.Id.ToString(), fileFullPath, batchNo
|
|
|
|
|
, false, null, true).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
//将格式单附件写入订舱的附件
|
|
|
|
|
SaveEDIFile(bkRlt.Id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, taskBase.TenantId.Value).GetAwaiter();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "处理成功";
|
|
|
|
@ -751,6 +825,41 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 异步写入附件表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 异步写入附件表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="boookId">订舱ID</param>
|
|
|
|
|
/// <param name="FilePath">文件路径</param>
|
|
|
|
|
/// <param name="fileName">文件名</param>
|
|
|
|
|
/// <param name="tenantId">租户ID</param>
|
|
|
|
|
/// <param name="fileTypeCode">附件类型代码</param>
|
|
|
|
|
/// <param name="fileTypeName">附件类型名称</param>
|
|
|
|
|
/// <param name="moudle">附件模块代码</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
private async Task SaveEDIFile(long boookId, string FilePath, string fileName, long tenantId,
|
|
|
|
|
string fileTypeCode = "sifeed", string fileTypeName = "SI submitted", string moudle = "TaskSISubmitted")
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
直接将附件信息写入附件表
|
|
|
|
|
*/
|
|
|
|
|
//EDI文件
|
|
|
|
|
var bookFile = new BookingFile
|
|
|
|
|
{
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
FileName = fileName,
|
|
|
|
|
FilePath = FilePath,
|
|
|
|
|
TypeCode = fileTypeCode,
|
|
|
|
|
TypeName = fileTypeName,
|
|
|
|
|
BookingId = boookId,
|
|
|
|
|
TenantId = tenantId,
|
|
|
|
|
Moudle = moudle
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await _bookingFileRepository.InsertAsync(bookFile);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取SI反馈信息
|
|
|
|
|