修改格式单比对

usertest
jianghaiqing 4 months ago
parent 3c7d0722c8
commit f5e00e77b0

@ -937,13 +937,22 @@ namespace DS.WMS.Core.Op.Method
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var taskBcInfo = await tenantDb.Queryable<TaskBCInfo>().Where(x => x.Id == taskBcId).FirstAsync();
if (taskBcInfo != null && taskBcInfo.BOOKING_SLOT_ID == null)
if (taskBcInfo != null)
{
taskBcInfo.BOOKING_SLOT_ID = rlt.Data.Id;
await tenantDb.Updateable<TaskBCInfo>(taskBcInfo).UpdateColumns(x => new
if(taskBcInfo.BOOKING_SLOT_ID == null)
{
x.BOOKING_SLOT_ID
}).ExecuteCommandAsync();
taskBcInfo.BOOKING_SLOT_ID = rlt.Data.Id;
await tenantDb.Updateable<TaskBCInfo>(taskBcInfo).UpdateColumns(x => new
{
x.BOOKING_SLOT_ID
}).ExecuteCommandAsync();
}
var taskBaseInfo = await tenantDb.Queryable<TaskBaseInfo>().Where(x => x.Id == taskBcInfo.TASK_ID).FirstAsync();
if (taskBaseInfo.IS_PUBLIC == 1)
{
}
}
}
return rlt;

@ -206,11 +206,11 @@ namespace DS.WMS.Core.Sys.Method
string relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" });
if (!string.IsNullOrWhiteSpace(attachFileType))
relativePath += $"\\{attachFileType}";
//if (!string.IsNullOrWhiteSpace(attachFileType))
// relativePath += $"\\{attachFileType}";
if (!string.IsNullOrWhiteSpace(fileDictKey))
relativePath += $"\\{fileDictKey}";
//if (!string.IsNullOrWhiteSpace(fileDictKey))
// relativePath += $"\\{fileDictKey}";
string? dirAbs;
if (string.IsNullOrEmpty(fileRoot))
@ -294,7 +294,7 @@ namespace DS.WMS.Core.Sys.Method
// bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("\\", "\\\\") + ".*").Value;
//}
return DataResult<Tuple<string, string, string,int>>.Success(new Tuple<string, string, string,int>(fileAbsPath, fileSaveName, Path.GetFileName(sourceFilePath),fileSize));
return DataResult<Tuple<string, string, string,int>>.Success(new Tuple<string, string, string,int>(fileAbsPath, fileSaveName, Path.GetFileName(fileAbsPath),fileSize));
}
#endregion
}

@ -433,6 +433,33 @@ namespace DS.WMS.Core.TaskPlat.Dtos.Mapper
.Map(dest => dest.CBM, src => src.CBM)
.Map(dest => dest.CtnNum, src => src.CtnNum);
}
{
TypeAdapterConfig<SeaExport, BusinessInfo>.NewConfig().TwoWays()
.Map(dest => dest.BookingNo, src => src.BookingNo)
//.Map(dest => dest.YardCode, src => src.YARDID)
.Map(dest => dest.YardCName, src => src.Yard)
.Map(dest => dest.VesselName, src => src.Vessel)
.Map(dest => dest.VoyNo, src => src.Voyno)
.Map(dest => dest.MasterBlNo, src => src.MBLNO)
.Map(dest => dest.HouseBlNo, src => src.HBLNO)
//.Map(dest => dest.PortLoadId, src => src.PORTLOADID)
.Map(dest => dest.PortLoad, src => src.LoadPort)
//.Map(dest => dest.PortDischargeId, src => src.PORTDISCHARGEID)
.Map(dest => dest.PortDischarge, src => src.DischargePort)
//.Map(dest => dest.TransportId, src => src.TRANSPORTID)
.Map(dest => dest.Transport, src => src.TransPort)
//.Map(dest => dest.PlaceDeliveryId, src => src.PLACEDELIVERYID)
.Map(dest => dest.PlaceDelivery, src => src.DeliveryPlace)
//.Map(dest => dest.DestinationId, src => src.DESTINATIONID)
.Map(dest => dest.Destination, src => src.Destination)
.Map(dest => dest.PKGs, src => src.PKGS)
.Map(dest => dest.KGs, src => src.KGS)
.Map(dest => dest.CBM, src => src.CBM)
.Map(dest => dest.GoodsDescription, src => src.Description)
.Map(dest => dest.KindPKGs, src => src.KindPkgs);
}
}
}
}

@ -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;
}

@ -155,16 +155,16 @@ namespace DS.WMS.Core.TaskPlat.Method
var codePortList = _codePortService.GetAllList().GetAwaiter().GetResult().Data;
if (codePortList.Any(a => a.Id == model.LoadPortId))
mainInfo.PortLoad = codePortList.FirstOrDefault(a => a.Id == model.LoadPortId).PortName;
mainInfo.PortLoadId = codePortList.FirstOrDefault(a => a.Id == model.LoadPortId).EdiCode;
if (codePortList.Any(a => a.Id == model.DischargePortId))
mainInfo.PortDischarge = codePortList.FirstOrDefault(a => a.Id == model.DischargePortId).PortName;
mainInfo.PortDischargeId = codePortList.FirstOrDefault(a => a.Id == model.DischargePortId).EdiCode;
if (codePortList.Any(a => a.Id == model.DeliveryPlaceId))
mainInfo.PlaceDelivery = codePortList.FirstOrDefault(a => a.Id == model.DeliveryPlaceId).PortName;
mainInfo.PlaceDeliveryId = codePortList.FirstOrDefault(a => a.Id == model.DeliveryPlaceId).EdiCode;
if (codePortList.Any(a => a.Id == model.DestinationId))
mainInfo.Destination = codePortList.FirstOrDefault(a => a.Id == model.DestinationId).PortName;
mainInfo.DestinationId = codePortList.FirstOrDefault(a => a.Id == model.DestinationId).EdiCode;
var mapCarrierList = _mappingCarrierService.GetAllList().GetAwaiter().GetResult().Data;

@ -29,11 +29,13 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NLog;
using NPOI.XWPF.UserModel;
using SqlSugar;
using System;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
@ -52,7 +54,7 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly ICodeCtnService codeCtnService;
private readonly IUserService _userService;
private readonly IUserEmailService _userEmailService;
private readonly IWebHostEnvironment _environment;
// 按需构建
private Lazy<IBookingSlotService> bookingSlotService;
@ -89,10 +91,12 @@ namespace DS.WMS.Core.TaskPlat.Method
this.codeCtnService = codeCtnService;
_userService = userService;
_userEmailService = userEmailService;
_environment = environment;
bookingSlotService = new Lazy<IBookingSlotService>(serviceProvider.GetRequiredService<IBookingSlotService>);
seaExportService = new Lazy<ISeaExportService>(serviceProvider.GetRequiredService<ISeaExportService>);
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>);
}
/// <summary>
@ -1415,14 +1419,19 @@ namespace DS.WMS.Core.TaskPlat.Method
Logger.Log(NLog.LogLevel.Info, $"获取订舱附件地址,结果:{fileInfo.FILE_PATH}");
//var opt = App.GetOptions<BookingAttachOptions>();
//var dirAbs = opt.basePath;
//if (string.IsNullOrEmpty(dirAbs))
//{
// dirAbs = App.WebHostEnvironment.WebRootPath;
//}
string fileRoot = AppSetting.app(new string[] { "FileSettings", "BasePath" });
string? dirAbs;
if (string.IsNullOrEmpty(fileRoot))
{
dirAbs = Path.Combine(_environment.WebRootPath ?? "");
}
else
{
dirAbs = Path.Combine(fileRoot);
}
filePath = "";//Path.Combine(dirAbs, fileInfo.FILE_PATH);
filePath = Path.Combine(dirAbs, fileInfo.FILE_PATH);
EmailApiUserDefinedDto emailApiUserDefinedDto = new EmailApiUserDefinedDto
@ -1507,17 +1516,21 @@ namespace DS.WMS.Core.TaskPlat.Method
*/
try
{
//string templatePath = App.Configuration["EmailTemplateFilePath"];
var basePath = AppSetting.app(new string[] { "EmailTemplate", "BasePath" });
var relativePath = AppSetting.app(new string[] { "EmailTemplate", "RelativePath" });
string templatePath = "";
string dirAbs = string.Empty;
//var opt = App.GetOptions<BookingAttachOptions>();
//var dirAbs = opt.basePath;
//if (string.IsNullOrEmpty(dirAbs))
//{
// dirAbs = App.WebHostEnvironment.WebRootPath;
//}
//templatePath = $"{dirAbs}{templatePath}\\BCEmailTemplate.html";
if (string.IsNullOrEmpty(basePath))
{
dirAbs = Path.Combine(_environment.WebRootPath, relativePath);
}
else
{
dirAbs = Path.Combine(basePath, relativePath);
}
string templatePath = $"{dirAbs}\\BCEmailTemplate.html";
string baseHtml = File.ReadAllText(templatePath);
@ -1662,15 +1675,21 @@ namespace DS.WMS.Core.TaskPlat.Method
*/
try
{
string templatePath = ""; //App.Configuration["EmailTemplateFilePath"];
string dirAbs = "";
//var opt = App.GetOptions<BookingAttachOptions>();
//var dirAbs = opt.basePath;
//if (string.IsNullOrEmpty(dirAbs))
//{
// dirAbs = App.WebHostEnvironment.WebRootPath;
//}
templatePath = $"{dirAbs}{templatePath}\\BCModifyEmailTemplate.html";
var basePath = AppSetting.app(new string[] { "EmailTemplate", "BasePath" });
var relativePath = AppSetting.app(new string[] { "EmailTemplate", "RelativePath" });
string dirAbs = string.Empty;
if (string.IsNullOrEmpty(basePath))
{
dirAbs = Path.Combine(_environment.WebRootPath, relativePath);
}
else
{
dirAbs = Path.Combine(basePath, relativePath);
}
string templatePath = $"{dirAbs}\\BCModifyEmailTemplate.html";
string baseHtml = File.ReadAllText(templatePath);

@ -87,5 +87,9 @@
},
"RedisInfo": {
"RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15"
},
"EmailTemplate": {
"BasePath": "", //使
"RelativePath": "TaskEmailTemplate"
}
}

Loading…
Cancel
Save