|
|
|
@ -31,6 +31,8 @@ using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using DS.WMS.Core.Sys.Method;
|
|
|
|
|
using NPOI.HPSF;
|
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
@ -42,6 +44,9 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
private readonly ISaasDbService saasService;
|
|
|
|
|
private readonly IDjyServiceStatusService _djyServiceStatusService;
|
|
|
|
|
private readonly ISysFileService _sysFileService;
|
|
|
|
|
private readonly IMappingYardService _mappingYardService;
|
|
|
|
|
private readonly IMappingCarrierService _mappingCarrierService;
|
|
|
|
|
private readonly ICodePortService _codePortService;
|
|
|
|
|
|
|
|
|
|
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
@ -52,6 +57,9 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
const string CONST_DRAFT_FILE_CODE = "draft";
|
|
|
|
|
const string CONST_DRAFT_FILE_NAME = "格式单";
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_YARD_MODULE = "BillTrace";
|
|
|
|
|
const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping";
|
|
|
|
|
|
|
|
|
|
public TaskDraftCompareService(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
@ -60,6 +68,9 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
_djyServiceStatusService = _serviceProvider.GetRequiredService<IDjyServiceStatusService>();
|
|
|
|
|
_sysFileService = _serviceProvider.GetRequiredService<ISysFileService>();
|
|
|
|
|
_mappingYardService = _serviceProvider.GetRequiredService<IMappingYardService>();
|
|
|
|
|
_mappingCarrierService = _serviceProvider.GetRequiredService<IMappingCarrierService>();
|
|
|
|
|
_codePortService = _serviceProvider.GetRequiredService<ICodePortService>();
|
|
|
|
|
|
|
|
|
|
draftReadUrl = AppSetting.app(new string[] { "DraftCompare", "ReadUrl" });
|
|
|
|
|
draftCompareUrl = AppSetting.app(new string[] { "DraftCompare", "Url" });
|
|
|
|
@ -113,7 +124,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
var fileRlt = await _sysFileService.SaveFileDirect(model.Head.GID, file.ToByteArray(), batchNo, file.FileName, "bcfiles");
|
|
|
|
|
|
|
|
|
|
var fileFullName = fileRlt.Data.Item2;
|
|
|
|
|
var fileFullName = fileRlt.Data.Item1;
|
|
|
|
|
|
|
|
|
|
//附件暂存
|
|
|
|
|
//var fileFullName = "";//await FileAttachHelper.TempSaveWebFile(model.Head.GID, file, batchNo, CONST_DRAFT_FILE_CODE);
|
|
|
|
@ -166,7 +177,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
throw new Exception($"请求Draft文件解析未获取到有效提单号");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bookingOrder = tenantDb.Queryable<SeaExport>().First(a => a.MBLNO.Equals(billNo) && a.OrgId == 1750335875591573504);
|
|
|
|
|
var bookingOrder = tenantDb.Queryable<SeaExport>().First(a => a.MBLNO.Equals(billNo));
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
{
|
|
|
|
@ -197,6 +208,42 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
//请求格式单比对接口
|
|
|
|
|
var mainInfo = bookingOrder.Adapt<BusinessInfo>();
|
|
|
|
|
|
|
|
|
|
//这里需要对场站进行映射翻译
|
|
|
|
|
var mapYardList = _mappingYardService.GetAllList().GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
if (mapYardList.Count > 0)
|
|
|
|
|
mapYardList = mapYardList.Where(a => a.Module.Equals(CONST_MAPPING_YARD_MODULE, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
if (mapYardList.Any(a => a.LinkId == bookingOrder.YardId))
|
|
|
|
|
{
|
|
|
|
|
mainInfo.YardCode = mapYardList.FirstOrDefault(a => a.LinkId == bookingOrder.YardId).MapCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.LoadPortId))
|
|
|
|
|
mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.LoadPortId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DischargePortId))
|
|
|
|
|
mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DischargePortId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DeliveryPlaceId))
|
|
|
|
|
mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DeliveryPlaceId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DestinationId))
|
|
|
|
|
mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DestinationId).EdiCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var mapCarrierList = _mappingCarrierService.GetAllList().GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
//if (mapCarrierList.Count > 0)
|
|
|
|
|
// mapCarrierList = mapCarrierList.Where(a => a.Module.Equals(CONST_MAPPING_CARRIER_MODULE, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
//if (mapYardList.Any(a => a.LinkId == bookingOrder.CarrierId))
|
|
|
|
|
//{
|
|
|
|
|
// mainInfo.CarrierCode = mapYardList.FirstOrDefault(a => a.LinkId == model.CarrierId).MapCode;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId);
|
|
|
|
|
|
|
|
|
|
mainInfo.BusiPKId = bookingOrder.Id.ToString();
|
|
|
|
@ -273,10 +320,10 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, "批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////如果确认文件读取成功
|
|
|
|
|
//如果确认文件读取成功
|
|
|
|
|
var bookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo, false, "draftfiles");
|
|
|
|
|
|
|
|
|
|
////将格式单附件写入订舱的附件
|
|
|
|
|
//将格式单附件写入订舱的附件
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, bookFilePath.Data.Item2, new System.IO.FileInfo(fileFullName).Name, long.Parse(user.TenantId), bookFilePath.Data.Item4,
|
|
|
|
|
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
|
|
|
|
|
|
|
|
|
@ -530,7 +577,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId">订舱主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/TaskDraftCompare/GetDraftCompareResultInfo")]
|
|
|
|
|
public async Task<TaskManageExcuteResultDto> GetDraftCompareResultInfo([FromQuery] long bookingId)
|
|
|
|
|
{
|
|
|
|
|
string batchNo = GuidHelper.GetSnowflakeId();
|
|
|
|
@ -661,7 +707,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// <param name="fileAttach">请求附件文件</param>
|
|
|
|
|
/// <param name="jsonData">邮件Draft比对请求报文</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[AllowAnonymous, HttpPost("/TaskDraftCompare/ExcuteEmailAttachedSheetDraftCompare"), ApiUser(ApiCode = "BCTaskManage")]
|
|
|
|
|
public async Task<TaskManageExcuteResultDto> ExcuteEmailAttachedSheetDraftCompareAsync(IFormFile file, IFormFile fileAttach, string jsonData)
|
|
|
|
|
{
|
|
|
|
|
string batchNo = GuidHelper.GetSnowflakeId();
|
|
|
|
@ -700,14 +745,17 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var fileRlt = await _sysFileService.SaveFileDirect(model.Head.GID, file.ToByteArray(), batchNo, file.FileName, "bcfiles");
|
|
|
|
|
|
|
|
|
|
var fileFullName = fileRlt.Data.Item1;
|
|
|
|
|
//附件暂存
|
|
|
|
|
var fileFullName = "";//await FileAttachHelper.TempSaveWebFile(model.Head.GID, file, batchNo, CONST_DRAFT_FILE_CODE);
|
|
|
|
|
|
|
|
|
|
string fileAttchedFullName = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (fileAttach != null)
|
|
|
|
|
{
|
|
|
|
|
//fileAttchedFullName = await FileAttachHelper.TempSaveWebFile(model.Head.GID, fileAttach, batchNo, CONST_DRAFT_FILE_CODE);
|
|
|
|
|
var fileAttachRlt = await _sysFileService.SaveFileDirect(model.Head.GID, fileAttach.ToByteArray(), batchNo, file.FileName, "bcfiles");
|
|
|
|
|
fileAttchedFullName = fileAttachRlt.Data.Item1;
|
|
|
|
|
}
|
|
|
|
|
//Draft文件解析
|
|
|
|
|
NameValueCollection par = new NameValueCollection();
|
|
|
|
@ -811,6 +859,31 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
//var userInfo = _sysUserRepository.AsQueryable().First(a => a.Id == bookingOrder.CreatedUserId);
|
|
|
|
|
|
|
|
|
|
//这里需要对场站进行映射翻译
|
|
|
|
|
var mapYardList = _mappingYardService.GetAllList().GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
if (mapYardList.Count > 0)
|
|
|
|
|
mapYardList = mapYardList.Where(a => a.Module.Equals(CONST_MAPPING_YARD_MODULE, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
if (mapYardList.Any(a => a.LinkId == bookingOrder.YardId))
|
|
|
|
|
{
|
|
|
|
|
mainInfo.YardCode = mapYardList.FirstOrDefault(a => a.LinkId == bookingOrder.YardId).MapCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.LoadPortId))
|
|
|
|
|
mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.LoadPortId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DischargePortId))
|
|
|
|
|
mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DischargePortId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DeliveryPlaceId))
|
|
|
|
|
mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DeliveryPlaceId).EdiCode;
|
|
|
|
|
|
|
|
|
|
if (codePortList.Any(a => a.Id == bookingOrder.DestinationId))
|
|
|
|
|
mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == bookingOrder.DestinationId).EdiCode;
|
|
|
|
|
|
|
|
|
|
mainInfo.BusiPKId = bookingOrder.Id.ToString();
|
|
|
|
|
mainInfo.UserId = user.UserId;
|
|
|
|
|
mainInfo.UserName = user.UserName;
|
|
|
|
@ -869,25 +942,38 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
//推送状态 HDGSD-核对格式单
|
|
|
|
|
//await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true);
|
|
|
|
|
|
|
|
|
|
var pushModel = new EmbedServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
businessId = bookingOrder.Id.ToString(),
|
|
|
|
|
SourceType = 1,
|
|
|
|
|
StatusCodes = new List<EmbedServiceProjectStatusDetailDto> {
|
|
|
|
|
new EmbedServiceProjectStatusDetailDto{
|
|
|
|
|
StatusCode = "HDGSD"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var saveStatusRlt = await _djyServiceStatusService.SaveServiceStatus(pushModel);
|
|
|
|
|
|
|
|
|
|
//写日志
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, "批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果确认文件读取成功
|
|
|
|
|
//var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo);
|
|
|
|
|
var bookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo);
|
|
|
|
|
|
|
|
|
|
////将格式单附件写入订舱的附件
|
|
|
|
|
//await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, entity.TenantId.Value,
|
|
|
|
|
// CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
|
|
|
|
|
//将格式单附件写入订舱的附件
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, bookFilePath.Data.Item2, new System.IO.FileInfo(fileFullName).Name, long.Parse(user.TenantId), bookFilePath.Data.Item4,
|
|
|
|
|
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
|
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrWhiteSpace(fileAttchedFullName))
|
|
|
|
|
//{
|
|
|
|
|
// var currBookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileAttchedFullName, batchNo);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(fileAttchedFullName))
|
|
|
|
|
{
|
|
|
|
|
var currBookFilePath = await _sysFileService.MoveFile(bookingOrder.Id.ToString(), fileAttchedFullName, batchNo);
|
|
|
|
|
|
|
|
|
|
// //将格式单附件写入订舱的附件
|
|
|
|
|
// await SaveEDIFile(bookingOrder.Id, currBookFilePath, new System.IO.FileInfo(fileAttchedFullName).Name, entity.TenantId.Value,
|
|
|
|
|
// CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
|
|
|
|
|
//}
|
|
|
|
|
//将格式单附件写入订舱的附件
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, currBookFilePath.Data.Item2, new System.IO.FileInfo(fileAttchedFullName).Name, long.Parse(user.TenantId), currBookFilePath.Data.Item4,
|
|
|
|
|
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = compareResult;
|
|
|
|
|
}
|
|
|
|
|