cjy 4 months ago
commit 105f46ec97

@ -1115,5 +1115,11 @@ public static class MultiLanguageConst
[Description("解析日志异常,原因:{0}")]
public const string BookingSlotAuditLogDeserializeError = "BookingSlot_AuditLogDeserialize_Error";
/// <summary>
/// 执行舱位失败,原因:{0}
/// </summary>
[Description("执行舱位失败,原因:{0}")]
public const string BookingSlotApiReceiveError = "BookingSlot_ApiReceive_Error";
#endregion
}

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Op.Dtos;
namespace DS.WMS.Core.Code.Interface;
@ -73,4 +74,16 @@ public interface ICodeVesselService
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelCodeVessel(IdModel req);
/// <summary>
/// 获取所有船名基础数据
/// </summary>
/// <returns>返回船名基础数据列表</returns>
Task<DataResult<List<CodeVesselRes>>> GetAllList();
/// <summary>
/// 加载缓存
/// </summary>
/// <returns></returns>
Task<DataResult<string>> LoadCache(bool isReload = false);
}

@ -6,8 +6,11 @@ using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using SqlSugar;
namespace DS.WMS.Core.Code.Method;
@ -18,6 +21,8 @@ public class CodeVesselService:ICodeVesselService
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private readonly ISysCacheService _sysCacheService;
/// <summary>
///
/// </summary>
@ -28,6 +33,7 @@ public class CodeVesselService:ICodeVesselService
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
_sysCacheService = _serviceProvider.GetRequiredService<ISysCacheService>();
}
public DataResult<List<CodeVesselRes>> GetListByPage(PageRequest request)
@ -178,4 +184,31 @@ public class CodeVesselService:ICodeVesselService
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 获取所有船名基础数据
/// </summary>
/// <returns>返回船名基础数据列表</returns>
public async Task<DataResult<List<CodeVesselRes>>> GetAllList()
{
var list = await db.Queryable<CodeVessel>().Where(a => a.Status == StatusEnum.Enable)
.Select<CodeVesselRes>().ToListAsync();
if (list.Count > 0)
return DataResult<List<CodeVesselRes>>.Success(list);
return DataResult<List<CodeVesselRes>>.FailedData(list);
}
/// <summary>
/// 加载缓存
/// </summary>
/// <param name="isReload">是否强制加载</param>
/// <returns>返回回执</returns>
public async Task<DataResult<string>> LoadCache(bool isReload = false)
{
var list = GetAllList().GetAwaiter().GetResult().Data;
return await _sysCacheService.LoadCache(JsonConvert.SerializeObject(list),Sys.Method.SysCacheKeyEnum.CommonCodeVessel, isReload);
}
}

@ -328,27 +328,27 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 箱型代码
/// </summary>
public string CTNCODE { get; set; }
public string CtnCode { get; set; }
/// <summary>
/// 箱型名称
/// </summary>
public string CTNALL { get; set; }
public string CtnAll { get; set; }
/// <summary>
/// 箱量
/// </summary>
public int CTNNUM { get; set; }
public int CtnNum { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
public string CntrNo { get; set; }
/// <summary>
/// 箱封号
/// </summary>
public string SEALNO { get; set; }
public string SealNo { get; set; }
/// <summary>
/// 件数
@ -358,7 +358,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 包装
/// </summary>
public string KINDPKGS { get; set; }
public string KindPKGs { get; set; }
/// <summary>
/// 毛重
@ -373,32 +373,32 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 皮重
/// </summary>
public decimal TAREWEIGHT { get; set; }
public decimal TareWeight { get; set; }
/// <summary>
/// 箱状态
/// </summary>
public string CTNSTATUS { get; set; }
public string CtnStatus { get; set; }
/// <summary>
/// 称重方式
/// </summary>
public string WEIGHTYPE { get; set; }
public string WeighType { get; set; }
/// <summary>
/// 称重重量
/// </summary>
public decimal WEIGHKGS { get; set; }
public decimal WeighKGS { get; set; }
/// <summary>
/// 称重联系人
/// </summary>
public string WEIGHATTN { get; set; }
public string WeighAttn { get; set; }
/// <summary>
/// 总计箱量
/// </summary>
public int TOTALNUM { get; set; }
public int TotalNum { get; set; }
}
/// <summary>

@ -15,27 +15,32 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
public string Vessel { get; set; }
/// <summary>
/// 航次号
/// </summary>
public string VOYNO { get; set; }
public string Voyno { get; set; }
/// <summary>
/// 合约号
/// </summary>
public string CONTRACT_NO { get; set; }
public string ContractNo { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BOOKING_SLOT_TYPE { get; set; }
public string BookingSlotType { get; set; }
/// <summary>
/// 船公司主键
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CARRIERID { get; set; }
public string CarrierCode { get; set; }
///// <summary>
///// 收货地
@ -49,11 +54,11 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 装货港代码
/// </summary>
public string PORTLOADID { get; set; }
public string PortLoadId { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string PORTDISCHARGEID { get; set; }
public string PortDischargeId { get; set; }
/// <summary>
/// 租户Id
/// </summary>

@ -408,7 +408,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 箱量
/// </summary>
public Nullable<int> CTNNUM { get; set; }
public Nullable<int> CtnNum { get; set; }
/// <summary>
/// 件数

@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
///
/// </summary>
public class TaskManageExcuteResultDto
{
/// <summary>
/// 是否成功 true=成功 false=失败
/// </summary>
public bool succ { get; set; } = false;
/// <summary>
/// 状态 0-成功
/// </summary>
public int status { get; set; } = 0;
/// <summary>
/// 返回消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录数
/// </summary>
public int total { get; set; }
/// <summary>
/// 当前页列表数据
/// </summary>
public object rows { get; set; }
/// <summary>
/// 比对详情
/// </summary>
public CompareResultInfo extra { get; set; }
/// <summary>
/// 比对展示详情
/// </summary>
public List<CompareResultDetailInfo> extra2 { get; set; }
/// <summary>
/// 扩展值
/// </summary>
public object extra3 { get; set; }
/// <summary>
/// 场站统计详情
/// </summary>
public YardStatInfo yardStatInfo { get; set; }
}
public class CompareResultInfo
{
/// <summary>
/// 原数据主键(请求方业务主键)
/// </summary>
public string OrigPKId { get; set; }
/// <summary>
/// 比对ID
/// </summary>
public string TaskCompareId { get; set; }
/// <summary>
/// 原数据主单号
/// </summary>
public string MBlNo { get; set; }
/// <summary>
/// 是否存在差异 true-存在差异 false-一致
/// </summary>
public bool IsExistsDiff { get; set; } = false;
/// <summary>
/// 比较时间
/// </summary>
public DateTime CompareTime { get; set; }
/// <summary>
/// 明细
/// </summary>
public List<CompareResultDetailInfo> DetailList { get; set; }
/// <summary>
/// 展示明细
/// </summary>
public List<CompareResultDetailInfo> ShowDetailList { get; set; }
/// <summary>
/// 人工反馈结果
/// </summary>
public FeedBackResult ManualFeedBackResult { get; set; }
}
/// <summary>
///
/// </summary>
public class TaskManageExcuteCommonResultDto
{
/// <summary>
/// 是否成功 true=成功 false=失败
/// </summary>
public bool succ { get; set; } = false;
/// <summary>
/// 状态 0-成功
/// </summary>
public int status { get; set; } = 0;
/// <summary>
/// 返回消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录数
/// </summary>
public int total { get; set; }
/// <summary>
/// 当前页列表数据
/// </summary>
public object rows { get; set; }
/// <summary>
/// 扩展值
/// </summary>
public object extra { get; set; }
/// <summary>
/// 扩展值2
/// </summary>
public object extra2 { get; set; }
/// <summary>
/// 扩展值3
/// </summary>
public object extra3 { get; set; }
}
/// <summary>
/// 下货纸场站箱信息统计
/// </summary>
public class YardStatInfo
{
/// <summary>
/// 总箱数
/// </summary>
public int ContaNum { get; set; }
/// <summary>
/// 最新返场日期
/// </summary>
public Nullable<DateTime> LstReturnYardDate { get; set; }
/// <summary>
/// 有返场日期箱数
/// </summary>
public int ExistsReturnYardDateCtnNum { get; set; }
/// <summary>
/// 有集装箱号的合计数
/// </summary>
public int ExistsCtnNo { get; set; }
}
public class FeedBackResult
{
/// <summary>
/// 操作人
/// </summary>
public string OperUser { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public DateTime OperTime { get; set; }
/// <summary>
/// 备注
/// </summary>
public string OperNote { get; set; }
/// <summary>
/// 原因
/// </summary>
public string Reason { get; set; }
}
}

@ -0,0 +1,20 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Interface
{
public interface IBookingSlotStockService
{
/// <summary>
/// 计算舱位库存
/// </summary>
/// <param name="paraObj">请求参数</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> BookingSlotStock(BookingSlotStockUpdateModel paraObj);
}
}

@ -112,5 +112,11 @@ namespace DS.WMS.Core.Op.Interface
/// <returns>返回详情</returns>
Task<DataResult<MSKSPOTBookingInitDto>> GetInitInfo();
/// <summary>
/// 获取预订舱途径选择
/// </summary>
/// <returns>返回回执</returns>
Task<DataResult<List<string>>> GetBookingChannelSelectShow();
}
}

@ -20,6 +20,18 @@ using SqlSugar.IOC;
using Newtonsoft.Json;
using NLog;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Http;
using LanguageExt.Common;
using DS.Module.Core.Helpers;
using NPOI.SS.Formula.Functions;
using System.Text.RegularExpressions;
using DS.WMS.Core.Sys.Method;
using DS.WMS.Core.Map.Dtos;
using Org.BouncyCastle.Ocsp;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Map.Entity;
using DS.WMS.Core.Code.Dtos;
using System.Net.Http.Headers;
namespace DS.WMS.Core.Op.Method
{
@ -32,9 +44,33 @@ namespace DS.WMS.Core.Op.Method
private readonly ISeaExportService _seaExportService;
private readonly IBookingLabelService _bookingLabelService;
private readonly ILogAuditService _logAuditService;
private readonly ISysCacheService _sysCacheService;
private readonly ISysFileService _sysFileService;
private readonly IBookingSlotStockService _bookingSlotStockService;
private readonly string bcCompareUrl;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
const string CONST_BC_FILE_CODE = "bc";
const string CONST_BC_FILE_NAME = "Booking Confirmation";
const string CONST_BC_NOTICE_FILE_CODE = "bc_notice";
const string CONST_BC_NOTICE_FILE_NAME = "Booking Confirmation Notice";
const string CONST_BC_MODIFY_FILE_CODE = "bc_modify";
const string CONST_BC_MODIFY_FILE_NAME = "Booking Amendment";
const string CONST_BC_MODIFY_NOTICE_FILE_CODE = "bc_modifynotice";
const string CONST_BC_MODIFY_NOTICE_FILE_NAME = "Booking Amendment Notice";
//收货地名称解析装货港港口
const string RECEIPT_TO_PORTLOAD = "ReceiptToPortLoad";
//交货地名称解析卸货港港口
const string DELIVERY_TO_PORT = "DeliveryToPort";
public BookingSlotService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
@ -44,6 +80,11 @@ namespace DS.WMS.Core.Op.Method
_seaExportService = _serviceProvider.GetRequiredService<ISeaExportService>();
_bookingLabelService = _serviceProvider.GetRequiredService<IBookingLabelService>();
_logAuditService = _serviceProvider.GetRequiredService<ILogAuditService>();
_sysCacheService = _serviceProvider.GetRequiredService<ISysCacheService>();
_sysFileService = _serviceProvider.GetRequiredService<ISysFileService>();
_bookingSlotStockService = _serviceProvider.GetRequiredService<IBookingSlotStockService>();
bcCompareUrl = AppSetting.app(new string[] { "BCCompare", "Url" });
}
#region 保存舱位
@ -660,5 +701,864 @@ namespace DS.WMS.Core.Op.Method
return DataResult<BookingSlotBaseSaveOutput>.Success(rtn);
}
#endregion
#region 舱位接收保存、取消接口
/// <summary>
/// 舱位接收保存、取消接口
/// </summary>
/// <param name="jsonData">请求详情(JSON)</param>
/// <param name="file">BC附件</param>
/// <param name="modifyFile">BC修改附件</param>
/// <returns>返回回执</returns>
public async Task<DataResult<long>> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null)
{
long id = 0;
try
{
Logger.Log(NLog.LogLevel.Info, $"jsonData={jsonData} 接收请求舱位报文");
BookingSlotBaseApiDto dto = JsonConvert.DeserializeObject<BookingSlotBaseApiDto>(jsonData);
DynameFileInfo bcFile = null;
DynameFileInfo bcNoticeFile = null;
if (file != null)
{
bcFile = new DynameFileInfo
{
FileBytes = file.ToByteArray(),
FileName = file.FileName
};
}
if (modifyFile != null)
{
bcNoticeFile = new DynameFileInfo
{
FileBytes = modifyFile.ToByteArray(),
FileName = modifyFile.FileName
};
}
var rlt = await InnerApiReceive(dto, bcFile, bcNoticeFile);
id = rlt.Data;
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Error, $"执行舱位失败,原因:{ex.Message}");
return DataResult<long>.FailedData(id, string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotApiReceiveError)), ex.Message));
}
if (id == 0)
return DataResult<long>.FailedData(id);
return DataResult<long>.Success(id);
}
#endregion
#region 舱位接收保存、取消接口(内部接口)
/// <summary>
/// 舱位接收保存、取消接口(内部接口)
/// </summary>
/// <param name="dto">舱位详情</param>
/// <param name="file">原文件</param>
/// <param name="modifyFile">修改文件</param>
/// <returns>返回回执</returns>
public async Task<DataResult<long>> InnerApiReceive(BookingSlotBaseApiDto dto, DynameFileInfo file = null, DynameFileInfo modifyFile = null)
{
long id = 0;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//接口方法直接调用save、delete等方法会报错可能因为非token授权登录导致故重写一遍保存、删除代码
if (dto.OpType == "add" || dto.OpType == "update" || dto.OpType == "del" || dto.OpType == "cancellation")
{
//翻译船公司
if (!string.IsNullOrWhiteSpace(dto.DataObj.CarrierCode) && string.IsNullOrWhiteSpace(dto.DataObj.CarrierCode))
{
var allCarrierList = await _sysCacheService.GetAllCommonCodeFromCache<MappingCarrierRes>(SysCacheKeyEnum.CommonMappingCarrier);
if (allCarrierList.Succeeded)
{
var carrierInfo = allCarrierList.Data.Where(t => t.Code.Equals(dto.DataObj.CarrierCode, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (carrierInfo != null)
{
dto.DataObj.Carrier = carrierInfo.MapName?.Trim();
}
}
}
//翻译箱型代码
if (dto.DataObj.CtnList != null && dto.DataObj.CtnList.Count > 0 &&
dto.DataObj.CtnList.Any(t => string.IsNullOrWhiteSpace(t.CtnCode)))
{
List<CodeCtnRes> ctnCodeList = new List<CodeCtnRes>();
var allCtnCodeList = await _sysCacheService.GetAllCommonCodeFromCache<CodeCtnRes>(SysCacheKeyEnum.CommonMappingCarrier);
if (allCtnCodeList.Succeeded)
{
ctnCodeList = allCtnCodeList.Data;
}
dto.DataObj.CtnList.ForEach(t =>
{
if (!string.IsNullOrWhiteSpace(t.CtnAll) && string.IsNullOrWhiteSpace(t.CtnCode))
{
var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) &&
a.CtnName.Equals(t.CtnAll, StringComparison.OrdinalIgnoreCase));
if (ctnCode != null)
t.CtnCode = $"{ctnCode.CtnSize}{ctnCode.CtnType}";
}
});
}
List<CodePortRes> portCodeList = new List<CodePortRes>();
// 解析收货地,得到装货港名称及五字码
if (!string.IsNullOrWhiteSpace(dto.DataObj.PlaceReceipt))
{
var portEnName = dto.DataObj.PlaceReceipt.Split(',')[0]?.Trim();
//这里CMA的收货地全称放在了括号里面
if (dto.DataObj.CarrierCode.Equals("CMA", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PlaceReceipt))
dto.DataObj.PlaceReceipt = dto.DataObj.PlaceReceipt.Replace("", "(").Replace("", ")");
if (dto.DataObj.PlaceReceipt.IndexOf("(") >= 0)
{
string currStr = Regex.Match(dto.DataObj.PlaceReceipt, "(?<=\\().*(?=\\))").Value?.Trim();
portEnName = currStr.Split(',')[0]?.Trim();
}
}
if (!string.IsNullOrWhiteSpace(portEnName))
{
var allPortCodeList = await _sysCacheService.GetAllCommonCodeFromCache<CodePortRes>(SysCacheKeyEnum.CommonCodePort);
if (allPortCodeList.Succeeded)
{
portCodeList = allPortCodeList.Data;
}
//var cachePortLoad = await _cache.GetAllCodePortLoad();
var portInfo = await PlaceReceiptToPortload(portEnName, portCodeList, () => _sysCacheService.GetAllCommonCodeFromCache<MappingPortRes>(SysCacheKeyEnum.CommonCodePort));
if (!portInfo.Succeeded)
{
Logger.Log(NLog.LogLevel.Info, $"通过收货地城市名称未匹配到港口信息,订舱编号:{dto.DataObj.SlotBookingNo}");
}
else
{
dto.DataObj.PortLoad = portInfo.Data.PortName;
dto.DataObj.PortLoadId = portInfo.Data.EdiCode;
}
}
else
{
Logger.Log(NLog.LogLevel.Info, $"收货地分割后得到的城市名称为空,订舱编号:{dto.DataObj.SlotBookingNo}");
}
}
else
{
Logger.Log(NLog.LogLevel.Info, $"收货地为空,订舱编号:{dto.DataObj.SlotBookingNo}");
}
// 解析交货地,得到为卸货港名称及五字码, 以及国家信息
if (!string.IsNullOrWhiteSpace(dto.DataObj.PlaceDelivery))
{
var portEnName = dto.DataObj.PlaceDelivery.Split(',')[0]?.Trim();
//这里CMA的收货地全称放在了括号里面
if (dto.DataObj.CarrierCode.Equals("CMA", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PlaceDelivery))
dto.DataObj.PlaceDelivery = dto.DataObj.PlaceDelivery.Replace("", "(").Replace("", ")");
if (dto.DataObj.PlaceDelivery.IndexOf("(") >= 0)
{
string currStr = Regex.Match(dto.DataObj.PlaceDelivery, "(?<=\\().*(?=\\))").Value?.Trim();
portEnName = currStr.Split(',')[0]?.Trim();
}
}
if (!string.IsNullOrWhiteSpace(portEnName))
{
if (portCodeList.Count == 0)
{
var allPortCodeList = await _sysCacheService.GetAllCommonCodeFromCache<CodePortRes>(SysCacheKeyEnum.CommonCodePort);
if (allPortCodeList.Succeeded)
{
portCodeList = allPortCodeList.Data;
}
}
var portInfo = await PlaceDeliveryToPort(portEnName, portCodeList, () => _sysCacheService.GetAllCommonCodeFromCache<MappingPortRes>(SysCacheKeyEnum.CommonCodePort));
if (portInfo.Succeeded)
{
Logger.Log(NLog.LogLevel.Info, $"通过交货地城市名称未匹配到港口信息,订舱编号:{dto.DataObj.SlotBookingNo}");
}
else
{
var allCountryCodeList = await _sysCacheService.GetAllCommonCodeFromCache<CodeCountryRes>(SysCacheKeyEnum.CommonCodeCountry);
if(allCountryCodeList.Succeeded)
{
var countryInfo = allCountryCodeList.Data.FirstOrDefault(p => p.Id == portInfo.Data.CountryId);
dto.DataObj.PortDischargeCountry = countryInfo?.CountryEnName;
dto.DataObj.PortDischargeCountryCode = countryInfo?.CountryCode;
}
dto.DataObj.PortDischarge = portInfo.Data.PortName;
dto.DataObj.PortDischargeId = portInfo.Data.EdiCode;
}
}
else
{
Logger.Log(NLog.LogLevel.Info, $"交货地分割后得到的城市名称为空,订舱编号:{ dto.DataObj.SlotBookingNo}");
}
}
else
{
Logger.Log(NLog.LogLevel.Info, $"交货地为空,订舱编号:{dto.DataObj.SlotBookingNo}");
}
if (string.IsNullOrWhiteSpace(dto.DataObj.CtnStat))
{
if (dto.DataObj.CtnList != null && dto.DataObj.CtnList.Count > 0)
{
dto.DataObj.CtnStat = string.Join(",", dto.DataObj.CtnList.GroupBy(a => a.CtnAll).Select(a =>
$"{a.Key}*{a.Select(b => b.CtnNum).Sum()}").ToArray());
}
}
//自动转换对应标签
BookingSlotBase model = null;
if (dto.OpType == "add")
{
var c = tenantDb.Queryable<BookingSlotBase>().Where(x => x.SlotBookingNo == dto.DataObj.SlotBookingNo).Count();
if (c > 0)
{
//订舱提单号已存在
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)));
}
model = dto.DataObj.Adapt<BookingSlotBase>();
await tenantDb.Insertable<BookingSlotBase>(model).ExecuteReturnEntityAsync();
id = model.Id;
foreach (var ctn in dto.DataObj.CtnList)
{
var newCtn = ctn.Adapt<BookingSlotCtn>();
newCtn.SlotId = model.Id;
await tenantDb.Insertable<BookingSlotCtn>(newCtn).ExecuteCommandAsync();
}
//await InsLog("Add", model.Id, "新增舱位");
string batchNo = GuidHelper.GetSnowflakeId();
//处理附件
if (file != null)
{
Logger.Log(NLog.LogLevel.Info, $"请求文件名:{file.FileName}");
var fileRlt = await _sysFileService.SaveFileDirect(model.Id.ToString(), file.FileBytes, batchNo, file.FileName, "bcfiles");
var fileFullPath = fileRlt.Data;
Logger.Log(NLog.LogLevel.Info, $"保存文件路径:{fileFullPath}");
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
}
}
if (modifyFile != null)
{
Logger.Log(NLog.LogLevel.Info, $"请求文件名(变更文件):{modifyFile.FileName}");
var fileRlt = await _sysFileService.SaveFileDirect(model.Id.ToString(), modifyFile.FileBytes, batchNo, modifyFile.FileName, "bcnoticefiles");
var fileFullPath = fileRlt.Data;
Logger.Log(NLog.LogLevel.Info, $"保存文件路径(变更文件):{fileFullPath}");
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_NOTICE_FILE_CODE, CONST_BC_NOTICE_FILE_NAME).GetAwaiter();
}
}
//触发标签自动绑定
await GenerateSlotLabel(dto, id);
}
else if (dto.OpType == "update")
{
model = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(x => x.SlotBookingNo == dto.DataObj.SlotBookingNo);
if (model == null)
{
//throw Oops.Bah($"未找到订舱编号为 {dto.DataObj.SlotBookingNo} 的数据");
}
id = model.Id;
//生成待比对详情
ParserBCInfoDto bcSrcDto = new ParserBCInfoDto();
try
{
bcSrcDto = model.Adapt<ParserBCInfoDto>();
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Info, $"slotId={model.Id} 映射数据库对象请求对应异常,原因:{ex.Message}");
//throw Oops.Bah($"slotId={model.Id} 映射数据库对象请求对应异常,原因:{ex.Message}");
}
ParserBCInfoDto bcTargetDto = new ParserBCInfoDto();
try
{
bcTargetDto = dto.DataObj.Adapt<ParserBCInfoDto>();
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Info, $"slotId={model.Id} 映射推送的舱位请求对应异常,原因:{ex.Message}");
//throw Oops.Bah($"slotId={model.Id} 映射推送的舱位请求对应异常,原因:{ex.Message}");
}
Logger.Log(NLog.LogLevel.Info, $"slotId={model.Id} 开始处理重要提醒");
//执行差异重要提醒
//await MeasureDiffCautionTask(bcSrcDto, bcTargetDto, model.Id);
Logger.Log(NLog.LogLevel.Info, $"slotId={model.Id} 处理重要提醒结束");
//提取箱信息
var ctnList = tenantDb.Queryable<BookingSlotCtn>()
.Where(x => x.SlotId == model.Id).ToList();
if (ctnList != null)
{
bcSrcDto.CtnList = ctnList.GroupBy(x => x.CtnAll)
.Select(x =>
{
return new ParserBCCTNInfoDto
{
CtnALL = x.Key,
CtnNum = x.ToList()
.Sum(a => a.CtnNum)
};
}).ToList();
}
if (dto.DataObj.CtnList != null && dto.DataObj.CtnList.Count > 0)
{
bcTargetDto.CtnList = dto.DataObj.CtnList.GroupBy(x => x.CtnAll)
.Select(x =>
{
return new ParserBCCTNInfoDto
{
CtnALL = x.Key,
CtnNum = x.ToList()
.Sum(a => a.CtnNum)
};
}).ToList();
}
var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>();
dto.DataObj.Adapt(model);
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
// 2.如果有变化,则需要更新旧的库存信息
bool isNeedUpdateOldStock = false;
if (oldObj.Vessel != model.Vessel
|| oldObj.Voyno != model.Voyno
|| oldObj.BookingSlotType != model.BookingSlotType
|| oldObj.CarrierId != model.CarrierId
|| oldObj.PortLoadId != model.PortLoadId
|| oldObj.PortDischargeId != model.PortDischargeId)
{
isNeedUpdateOldStock = true;
}
await tenantDb.Updateable<BookingSlotBase>(model).ExecuteCommandAsync();
if (isNeedUpdateOldStock)
{
//BookingSlotStock:Update
await _bookingSlotStockService.BookingSlotStock(new BookingSlotStockUpdateModel
{
BookingSlotType = oldObj.BookingSlotType,
CarrierCode = oldObj.CarrierCode,
ContractNo = oldObj.ContractNo,
Vessel = oldObj.Vessel,
Voyno = oldObj.Voyno,
PortLoadId = oldObj.PortLoadId,
PortDischargeId = oldObj.PortDischargeId,
TenantId = long.Parse(user.TenantId)
});
}
var currCtnList = await tenantDb.Queryable<BookingSlotCtn>().Where(p => p.SlotId == model.Id).ToListAsync();
if (currCtnList.Count > 0)
{
currCtnList.ForEach(async p =>
{
await tenantDb.Deleteable<BookingSlotCtn>(p).ExecuteCommandAsync();
});
}
foreach (var ctn in dto.DataObj.CtnList)
{
var newCtn = ctn.Adapt<BookingSlotCtn>();
newCtn.SlotId = model.Id;
await tenantDb.Insertable<BookingSlotCtn>(newCtn).ExecuteCommandAsync();
}
//await InsLog("Update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, nameof(BookingSlotBaseApiSaveDto.CtnList), nameof(BookingSlotBaseApiSaveDto.BookingSlotSaleInfoList));
string batchNo = GuidHelper.GetSnowflakeId();
//处理附件
if (file != null)
{
Logger.Log(NLog.LogLevel.Info, $"请求文件名:{file.FileName}");
var fileRlt = await _sysFileService.SaveFileDirect(model.Id.ToString(), file.FileBytes, batchNo, file.FileName, "bcmoidfyfiles");
var fileFullPath = fileRlt.Data;
Logger.Log(NLog.LogLevel.Info, $"保存文件路径:{fileFullPath}");
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_FILE_CODE, CONST_BC_MODIFY_FILE_NAME).GetAwaiter();
}
}
if (modifyFile != null)
{
Logger.Log(NLog.LogLevel.Info, $"请求文件名(变更文件):{modifyFile.FileName}");
var fileRlt = await _sysFileService.SaveFileDirect(model.Id.ToString(), modifyFile.FileBytes, batchNo, modifyFile.FileName, "bcmodifynoticefiles");
var fileFullPath = fileRlt.Data;
Logger.Log(NLog.LogLevel.Info, $"保存文件路径(变更文件):{fileFullPath}");
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_NOTICE_FILE_CODE, CONST_BC_MODIFY_NOTICE_FILE_NAME).GetAwaiter();
}
}
//一般更新数据指的是Booking Amendment,需要与舱位进行数据比对
await PushCompareBCInfo(bcSrcDto, bcTargetDto, id, dto.BatchNo);
//触发标签自动绑定
await GenerateSlotLabel(dto, id);
}
else if (dto.OpType == "del")
{
var slotNO = dto.DataObj.SlotBookingNo;
model = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(x => x.SlotBookingNo == slotNO);
if (model == null)
{
//throw Oops.Bah($"未找到订舱编号为 {slotNO} 的数据");
}
id = model.Id;
model.Deleted = true;
await tenantDb.Updateable<BookingSlotBase>(model).ExecuteCommandAsync();
var ctns = await tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == model.Id).ToListAsync();
foreach (var ctn in ctns)
{
ctn.Deleted = true;
await tenantDb.Updateable<BookingSlotCtn>(ctn).ExecuteCommandAsync();
}
//await InsLog("Del", model.Id, "取消舱位");
}
else if (dto.OpType == "cancellation")
{
// 更新标志
var slotNO = dto.DataObj.SlotBookingNo;
model = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(x => x.SlotBookingNo == slotNO);
if (model == null)
{
//throw Oops.Bah($"未找到订舱编号为 {slotNO} 的数据");
}
id = model.Id;
model.IsCancellation = true;
model.CancellationDate = DateTime.Now;
await tenantDb.Updateable<BookingSlotBase>(model).EnableDiffLogEvent().ExecuteCommandAsync();
// 删除该舱位相关的订舱关联关系
var slotList = await tenantDb.Queryable<BookingSlotAllocation>().Where(a => a.BookingSlotId == id).ToListAsync();
var slotIdList = slotList.Select(s => s.Id);
await tenantDb.Updateable<BookingSlotAllocation>()
.SetColumns(a => a.Deleted == true)
.SetColumns(a => a.UpdateTime == DateTime.Now)
.SetColumns(a => a.UpdateBy == long.Parse(user.UserId))
//.SetColumns(a => a.UpdatedUserName == UserManager.Name)
.Where(a => slotIdList.Contains(a.Id))
.ExecuteCommandAsync();
await tenantDb.Updateable<BookingSlotAllocationCtn>()
.SetColumns(a => a.Deleted == true)
.SetColumns(a => a.UpdateTime == DateTime.Now)
.SetColumns(a => a.UpdateBy == long.Parse(user.UserId))
//.SetColumns(a => a.UpdatedUserName == UserManager.Name)
.Where(a => slotIdList.Contains(a.SlotAllocId))
.ExecuteCommandAsync();
//await InsLog("Cancellation", model.Id, "取消舱位");
}
//更新库存
await _bookingSlotStockService.BookingSlotStock(new BookingSlotStockUpdateModel
{
BookingSlotType = model.BookingSlotType,
CarrierCode = model.CarrierCode,
ContractNo = model.ContractNo,
Vessel = model.Vessel,
Voyno = model.Voyno,
PortLoadId = model.PortLoadId,
PortDischargeId = model.PortDischargeId,
TenantId = long.Parse(user.TenantId)
});
}
else
{
//throw Oops.Bah("操作类型参数有误");
}
if(id == 0)
return DataResult<long>.FailedData(id);
return DataResult<long>.Success(id);
}
#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 = "bc", string fileTypeName = "Booking Confirmation", string moudle = "BookingSlot")
{
/*
*/
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var newFile = new OpFile
{
Id = SnowFlakeSingle.Instance.NextId(),
FileName = fileName,
FilePath = FilePath,
TypeCode = fileTypeCode,
TypeName = fileTypeName,
LinkId = boookId,
};
await tenantDb.Insertable(newFile).ExecuteCommandAsync();
}
#endregion
#region 根据收货地港口英文名解析出起始港对象
/// <summary>
/// 根据收货地港口英文名解析出起始港对象
/// </summary>
/// <param name="portEnName">收货地港口英文名</param>
/// <param name="cachePortLoad">起始港缓存</param>
/// <param name="cacheMapPortLoadFunc">起始港缓存映射</param>
/// <returns>起始港对象</returns>
private async Task<DataResult<CodePortRes>> PlaceReceiptToPortload(string portEnName, List<CodePortRes> cachePortLoad, Func<Task<DataResult<List<MappingPortRes>>>> cacheMapPortLoadFunc)
{
CodePortRes portInfo = null;
if (string.IsNullOrEmpty(portEnName))
{
return DataResult<CodePortRes>.FailedData(portInfo);
}
// 匹配方式1精准匹配
portInfo = cachePortLoad.FirstOrDefault(x => x.PortName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式2起始模糊匹配
portInfo = cachePortLoad.FirstOrDefault(x => x.PortName.StartsWith(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式3完整模糊匹配
portInfo = cachePortLoad.FirstOrDefault(x => x.PortName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式4精准映射匹配
var mapCachePortLoad = await cacheMapPortLoadFunc();
var map = mapCachePortLoad.Data.FirstOrDefault(x => x.Module == RECEIPT_TO_PORTLOAD
&& x.MapName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (map != null)
{
portInfo = cachePortLoad.FirstOrDefault(x => x.Id == map.LinkId);
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
}
return DataResult<CodePortRes>.FailedData(portInfo);
}
#endregion
#region 根据交货地港口英文名解析出目的港对象
/// <summary>
/// 根据交货地港口英文名解析出目的港对象
/// </summary>
/// <param name="portEnName">交货地港口英文名</param>
/// <param name="cachePort">目的港缓存</param>
/// <param name="cacheMapPortFunc">目的港缓存映射</param>
/// <returns>目的港对象</returns>
private async Task<DataResult<CodePortRes>> PlaceDeliveryToPort(string portEnName, List<CodePortRes> cachePort, Func<Task<DataResult<List<MappingPortRes>>>> cacheMapPortFunc)
{
CodePortRes portInfo = null;
if (string.IsNullOrEmpty(portEnName))
{
return DataResult<CodePortRes>.FailedData(portInfo);
}
// 匹配方式1精准匹配
portInfo = cachePort.FirstOrDefault(x => x.PortName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式2起始模糊匹配
portInfo = cachePort.FirstOrDefault(x => x.PortName.StartsWith(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式3完整模糊匹配
portInfo = cachePort.FirstOrDefault(x => x.PortName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
// 匹配方式4精准映射匹配
var mapCachePort = await cacheMapPortFunc();
var map = mapCachePort.Data.FirstOrDefault(x => x.Module == DELIVERY_TO_PORT
&& x.MapName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (map != null)
{
portInfo = cachePort.FirstOrDefault(x => x.Id == map.LinkId);
if (portInfo != null) return DataResult<CodePortRes>.Success(portInfo);
}
return DataResult<CodePortRes>.FailedData(portInfo);
}
#endregion
#region 推送BC变更比对
/// <summary>
/// 推送BC变更比对
/// </summary>
/// <param name="bcSrcDto">原舱位详情</param>
/// <param name="bcTargetDto">变更后舱位详情</param>
/// <param name="slotId">舱位主键</param>
/// <param name="reqBatchNo">请求批次号用来区分对应的哪个批次任务</param>
/// <returns></returns>
[NonAction]
public async Task PushCompareBCInfo(ParserBCInfoDto bcSrcDto, ParserBCInfoDto bcTargetDto, long slotId, string reqBatchNo)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
string batchNo = GuidHelper.GetSnowflakeId();
DateTime bDate = DateTime.Now;
Logger.Log(NLog.LogLevel.Info, $"批次={batchNo} slotId={slotId} 开始请求比对结果");
var compareResult = await ExcuteCompare(bcSrcDto, bcTargetDto);
Logger.Log(NLog.LogLevel.Info, $"批次={batchNo} slotId={slotId} 请求比对结果完成,结果={JsonConvert.SerializeObject(compareResult)}");
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
if (compareResult != null)
{
Logger.Log(NLog.LogLevel.Info, "批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
}
if (compareResult != null)
{
DateTime nowDate = DateTime.Now;
var hisInfo = tenantDb.Queryable<BookingSlotCompare>().First(a => a.CompareBatchNo == reqBatchNo);
if (hisInfo == null)
{
BookingSlotCompare entity = new BookingSlotCompare
{
SlotId = slotId,
CompareBatchNo = reqBatchNo,
CompareDiffNum = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0,
CreateTime = nowDate,
UpdateTime = nowDate,
CreateBy = long.Parse(user.UserId),
//CreatedUserName = UserManager.Name,
UpdateBy = long.Parse(user.UserId),
//UpdatedUserName = UserManager.Name,
CompareType = "BC_MODIFY",
CompareRlt = JsonConvert.SerializeObject(compareResult.extra.ShowDetailList),
};
await tenantDb.Insertable<BookingSlotCompare>(entity).ExecuteCommandAsync();
}
else
{
hisInfo.CompareDiffNum = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0;
hisInfo.UpdateTime = nowDate;
hisInfo.UpdateBy = long.Parse(user.UserId);
//hisInfo.UpdatedUserName = user.UserName;
hisInfo.CompareRlt = JsonConvert.SerializeObject(compareResult.extra.ShowDetailList);
await tenantDb.Updateable<BookingSlotCompare>(hisInfo).UpdateColumns(it =>
new
{
it.CompareDiffNum,
it.CompareRlt,
it.UpdateTime,
it.UpdateBy,
//it.UpdatedUserName
}).ExecuteCommandAsync();
}
//throw Oops.Oh($"舱位主键{slotId}请求BC比对失败返回为空");
//if (compareResult.extra.ShowDetailList == null || compareResult.extra.ShowDetailList.Count == 0)
//{
// new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败比对结果为0", $"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败比对结果为0", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
//}
}
else
{
//new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败,未获取到比对结果", $"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败,未获取到比对结果", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
}
#endregion
#region 请求BC比对
/// <summary>
/// 请求BC比对
/// </summary>
/// <param name="bcSrcDto">BC详情</param>
/// <param name="bcTargetDto">BC变更后详情</param>
/// <returns>返回回执</returns>
[NonAction]
public async Task<TaskManageExcuteResultDto> ExcuteCompare(ParserBCInfoDto bcSrcDto, ParserBCInfoDto bcTargetDto)
{
TaskManageExcuteResultDto model = null;
/*
1URL
2JSON
3POST
4
*/
var url = bcCompareUrl; //App.Configuration["BCCompareUrl"];
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bcSrcDto)));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "srcJson"
};
reduceAttach.Add(dataContent);
var dataContent2 = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bcTargetDto)));
dataContent2.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "destJson"
};
reduceAttach.Add(dataContent2);
//请求
var response = httpClient.PostAsync(url, reduceAttach).Result;
var result = response.Content.ReadAsStringAsync().Result;
model = JsonConvert.DeserializeObject<TaskManageExcuteResultDto>(result);
Logger.Log(NLog.LogLevel.Info, $"推送BC比返回结果{JsonConvert.SerializeObject(model)}");
}
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Error, "推送BC比对异常原因{error}", ex.Message);
// throw Oops.Oh($"推送BC比对异常原因{ex.Message}");
}
}
return model;
}
#endregion
}
}

@ -0,0 +1,251 @@
using DS.Module.Core;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NLog;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mapster;
using DS.WMS.Core.Op.Interface;
namespace DS.WMS.Core.Op.Method
{
/// <summary>
/// 舱位库存
/// </summary>
public class BookingSlotStockService: IBookingSlotStockService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public BookingSlotStockService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 计算舱位库存
/// </summary>
/// <param name="paraObj">请求参数</param>
/// <returns>返回回执</returns>
public async Task<DataResult<string>> BookingSlotStock(BookingSlotStockUpdateModel paraObj)
{
Logger.Log(NLog.LogLevel.Info, $"收到更新库存订阅请求:{ JsonConvert.SerializeObject(paraObj)}");
if (string.IsNullOrEmpty(paraObj.Vessel)
|| string.IsNullOrEmpty(paraObj.Voyno)
|| string.IsNullOrEmpty(paraObj.ContractNo)
|| string.IsNullOrEmpty(paraObj.BookingSlotType)
|| string.IsNullOrEmpty(paraObj.CarrierCode)
|| string.IsNullOrEmpty(paraObj.PortLoadId)
|| string.IsNullOrEmpty(paraObj.PortDischargeId))
{
Logger.Log(NLog.LogLevel.Info, $"收到更新库存订阅请求:部分参数存在空值,结束");
return DataResult<string>.FailedData(string.Empty);
}
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var baseList = await tenantDb.Queryable<BookingSlotBase>()
.Where(x => !x.Deleted
//&& x.TenantId == paraObj.TenantId
&& x.Vessel == paraObj.Vessel
&& x.Voyno == paraObj.Voyno
&& x.ContractNo == paraObj.ContractNo
&& x.BookingSlotType == paraObj.BookingSlotType
&& x.CarrierCode == paraObj.CarrierCode
&& x.PortLoadId == paraObj.PortLoadId
&& x.PortDischargeId == paraObj.PortDischargeId)
.OrderByDescending(x => x.UpdateTime)
.ToListAsync();
var stockObj = await tenantDb.Queryable<BookingSlotStock>()
.FirstAsync(x => !x.Deleted
//&& x.TenantId == paraObj.TenantId
&& x.Vessel == paraObj.Vessel
&& x.Voyno == paraObj.Voyno
&& x.ContractNo == paraObj.ContractNo
&& x.BookingSlotType == paraObj.BookingSlotType
&& x.CarrierCode == paraObj.CarrierCode
&& x.PortLoadId == paraObj.PortLoadId
&& x.PortDischargeId == paraObj.PortDischargeId);
if (!baseList.Any())
{
if (stockObj != null)
{
// 从库存表删除这7项维度的库存数据
await tenantDb.Deleteable<BookingSlotStock>(stockObj).ExecuteCommandAsync();
}
return DataResult<string>.FailedData(string.Empty);
}
var isInsert = stockObj == null;
var idTemp = stockObj?.Id;
stockObj = baseList[0].Adapt(stockObj);
if (isInsert)
{
stockObj.Id = 0;
}
else
{
stockObj.Id = (long)idTemp;
}
// 总舱位数
stockObj.TotalOrders = baseList.Count;
// 取消舱位数
stockObj.CancelNum = baseList.Count(x => x.IsCancellation);
// 舱位主键列表
var slotBaseIdList = baseList.Select(x => x.Id).ToList();
// 总的箱型箱量
var ctnAllList = await tenantDb.Queryable<BookingSlotCtn>()
.Where(x => !x.Deleted && slotBaseIdList.Contains(x.SlotId))
.GroupBy(x => x.CtnAll)
.Select(x => new
{
x.CtnAll,
CTNNUM = SqlFunc.AggregateSum(x.CtnNum)
}).ToListAsync();
stockObj.CtnStat = string.Join(' ', ctnAllList.Select(c => c.CtnAll + "*" + c.CTNNUM));
// 总箱数
stockObj.TotalCtns = ctnAllList.Sum(x => x.CTNNUM);
// 订舱引用表主键与订舱主表主键
var lstAllocKeyList = await tenantDb.Queryable<BookingSlotAllocation>()
//.Filter(null, true)
.Where(x => !x.Deleted && slotBaseIdList.Contains(x.BookingSlotId))
.Select(x => new { x.Id, x.BookingSlotId })
.ToListAsync();
// 如果舱位未被引用过,可以直接确定库存
if (!lstAllocKeyList.Any())
{
// 已使用舱位数
stockObj.UseNum = 0;
// 已使用的箱型箱量
stockObj.UseCtnStat = "";
// 已使用的箱数
stockObj.UseCtnsNum = 0;
// 剩余的箱型箱量
stockObj.RemainCtnStat = stockObj.CtnStat;
// 剩余箱数
stockObj.RemainCtnsNum = stockObj.TotalCtns;
}
else
{
// 已使用舱位数
//stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count();
// 订舱引用表主键列表
var allocIdList = lstAllocKeyList.Select(x => x.Id).ToList();
var allocSlotIdList = lstAllocKeyList.Select(x => x.BookingSlotId).Distinct().ToList();
var userCtnNumList = await tenantDb.Queryable<BookingSlotAllocationCtn>().Filter(null, true)
.Where(x => !x.Deleted && allocIdList.Contains(x.SlotAllocId))
.GroupBy(x => x.SlotAllocId)
.Select(x => new
{
x.SlotAllocId,
CTNNUM = SqlFunc.AggregateSum(x.CtnNum)
}).ToListAsync();
var hasCtnNumList = await tenantDb.Queryable<BookingSlotCtn>().Filter(null, true)
.Where(x => !x.Deleted && allocSlotIdList.Contains(x.SlotId))
.GroupBy(x => x.SlotId)
.Select(x => new
{
x.SlotId,
CTNNUM = SqlFunc.AggregateSum(x.CtnNum)
})
.ToListAsync();
var useNum = 0;
foreach (long slotId in allocSlotIdList)
{
List<long> temp1 = lstAllocKeyList.Where(x => x.BookingSlotId == slotId).Select(x => x.Id).ToList();
var userNum = userCtnNumList.Where(x => temp1.Contains(x.SlotAllocId)).Sum(x => x.CTNNUM);
var hasNum = hasCtnNumList.Where(x => x.SlotId == slotId).Sum(x => x.CTNNUM);
if (userNum >= hasNum)
{
useNum++;
}
}
// 已使用舱位数
stockObj.UseNum = useNum;
// 已使用的箱型箱量
var userCtnList = await tenantDb.Queryable<BookingSlotAllocationCtn>()
.Filter(null, true)
.Where(x => !x.Deleted && allocIdList.Contains(x.SlotAllocId))
.GroupBy(x => x.CtnAll)
.Select(x => new
{
x.CtnAll,
CTNNUM = SqlFunc.AggregateSum(x.CtnNum)
}).ToListAsync();
stockObj.UseCtnStat = string.Join(' ', userCtnList.Select(c => c.CtnAll + "*" + c.CTNNUM));
// 已使用的箱数
stockObj.UseCtnsNum = userCtnList.Sum(x => x.CTNNUM);
// 剩余的箱型箱量
Dictionary<string, int> remainCtnList = new(ctnAllList.Count);
foreach (var item in ctnAllList)
{
var useItem = userCtnList.FirstOrDefault(x => x.CtnAll == item.CtnAll);
if (useItem == null)
{
remainCtnList.Add(item.CtnAll, item.CTNNUM);
}
else
{
int remainCtnNum = item.CTNNUM - useItem.CTNNUM;
if (remainCtnNum > 0)
{
remainCtnList.Add(item.CtnAll, remainCtnNum);
}
}
}
stockObj.RemainCtnStat = string.Join(' ', remainCtnList.Select(x => x.Key + "*" + x.Value));
// 剩余箱数
stockObj.RemainCtnsNum = stockObj.TotalCtns - stockObj.UseCtnsNum;
}
if (isInsert)
{
await tenantDb.Insertable<BookingSlotStock>(stockObj).ExecuteCommandAsync();
}
else
{
await tenantDb.Updateable<BookingSlotStock>(stockObj).ExecuteCommandAsync();
}
return DataResult<string>.Success(string.Empty);
}
}
}

@ -30,6 +30,8 @@ using System.Text.Json.Nodes;
using LanguageExt.Pipes;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Map.Method;
using Microsoft.Owin.Security.Provider;
using LanguageExt;
namespace DS.WMS.Core.Op.Method
{
@ -54,6 +56,7 @@ namespace DS.WMS.Core.Op.Method
const string CONST_MSK_API_COMMODITY_URL = "MSKApiCommodity";
const string CONST_MSK_API_MAPPING_MODULE = "BOOK_MSK_API";
const string CONST_MSK_API_CHANNEL_SHOW = "BOOKING_CHANNEL_SELECT_SHOW";
const long CONST_ADMIN_TENANTID = 1288018625843826688;
@ -2166,5 +2169,27 @@ namespace DS.WMS.Core.Op.Method
return data;
}
#endregion
#region 获取预订舱途径选择
/// <summary>
/// 获取预订舱途径选择
/// </summary>
/// <returns>返回回执</returns>
public async Task<DataResult<List<string>>> GetBookingChannelSelectShow()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var rlt = await configService.GetConfig(CONST_MSK_API_CHANNEL_SHOW, long.Parse(user.TenantId), false);
if (rlt.Succeeded)
{
var list = rlt.Data.Value.Split(new char[] { ',' }).ToList();
return DataResult<List<string>>.Success(list);
}
return DataResult<List<string>>.FailedData(new List<string>());
}
#endregion
}
}

@ -0,0 +1,44 @@
using DS.Module.Core;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Map.Entity;
using DS.WMS.Core.Sys.Method;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Sys.Interface
{
/// <summary>
/// 公共缓存
/// </summary>
public interface ISysCacheService
{
/// <summary>
/// 获取缓存数据
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
/// <param name="cacheKey">缓存key枚举</param>
/// <returns></returns>
Task<DataResult<List<T>>> GetAllCommonCodeFromCache<T>(SysCacheKeyEnum cacheKey);
/// <summary>
/// 设置缓存
/// </summary>
/// <param name="cacheObj">被缓存的详情</param>
/// <param name="cacheKey">缓存key枚举</param>
/// <param name="outSecond">超期时间(毫米)</param>
/// <returns></returns>
Task<DataResult<string>> SetCommonCode(object cacheObj, SysCacheKeyEnum cacheKey, int outSecond = 0);
/// <summary>
/// 加载缓存
/// </summary>
/// <param name="cacheObj">被缓存的详情</param>
/// <param name="cacheKey">缓存key枚举</param>
/// <param name="isReload">是否强制刷新缓存</param>
/// <returns></returns>
Task<DataResult<string>> LoadCache(object cacheObj, SysCacheKeyEnum cacheKey, bool isReload = false);
}
}

@ -0,0 +1,18 @@
using DS.Module.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Sys.Interface
{
public interface ISysCommonCacheService
{
/// <summary>
/// 加载公共缓存数据
/// </summary>
/// <returns></returns>
Task<DataResult<string>> LoadCommonCache();
}
}

@ -26,5 +26,17 @@ namespace DS.WMS.Core.Sys.Interface
/// <param name="id"></param>
/// <returns></returns>
public DataResult<List<SysFileRes>> GetSysFileList(string id);
/// <summary>
/// 保存文件并返回文件完整路径
/// </summary>
/// <param name="fileDictKey">文件目录KEY</param>
/// <param name="fileBytes">文件二进制流</param>
/// <param name="batchNo">批次号</param>
/// <param name="fileName">文件名称</param>
/// <param name="attachFileType">附件类型</param>
/// <returns></returns>
Task<DataResult<string>> SaveFileDirect(string fileDictKey, byte[] fileBytes, string batchNo,
string fileName, string attachFileType);
}
}

@ -106,7 +106,10 @@ public class ConfigService : IConfigService
var data = await db.Queryable<SysConfig>().Filter(null, true)
.Where(x => x.Code == code && x.TenantId == tenantId).Select<ConfigRes>().FirstAsync();
if(data != null)
return DataResult<ConfigRes>.Success(data);
return DataResult<ConfigRes>.FailedData(data);
}
#endregion
}

@ -0,0 +1,154 @@
using DS.Module.Core;
using DS.Module.RedisModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Sys.Interface;
using LanguageExt;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Sys.Method
{
public class SysCacheService : ISysCacheService
{
private readonly IServiceProvider _serviceProvider;
private readonly IRedisService _redisService;
private readonly ICodeVesselService _codeVesselService;
public SysCacheService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_redisService = _serviceProvider.GetRequiredService<IRedisService>();
_codeVesselService = _serviceProvider.GetRequiredService<ICodeVesselService>();
}
/// <summary>
/// 获取缓存数据
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
/// <param name="cacheKey">缓存key枚举</param>
/// <returns>返回列表</returns>
public async Task<DataResult<List<T>>> GetAllCommonCodeFromCache<T>(SysCacheKeyEnum cacheKey)
{
var currVal =_redisService.GetValue<List<T>>(cacheKey.ToString());
if (currVal == null)
return DataResult<List<T>>.FailedData(new List<T>());
return DataResult<List<T>>.Success(currVal);
}
/// <summary>
/// 设置缓存
/// </summary>
/// <param name="cacheObj">被缓存的详情</param>
/// <param name="cacheKey">缓存key枚举</param>
/// <param name="outSecond">超期时间(毫米)</param>
/// <returns></returns>
public async Task<DataResult<string>> SetCommonCode(object cacheObj, SysCacheKeyEnum cacheKey, int outSecond = 0)
{
if (outSecond > 0)
_redisService.SetValue(cacheKey.ToString(), JsonConvert.SerializeObject(cacheObj), outSecond);
_redisService.SetValue(cacheKey.ToString(), JsonConvert.SerializeObject(cacheObj));
return DataResult<string>.Success(string.Empty);
}
/// <summary>
/// 加载缓存
/// </summary>
/// <param name="cacheObj">被缓存的详情</param>
/// <param name="cacheKey">缓存key枚举</param>
/// <param name="isReload">是否强制刷新缓存</param>
/// <returns></returns>
public async Task<DataResult<string>> LoadCache(object cacheObj, SysCacheKeyEnum cacheKey, bool isReload = false)
{
if (isReload)
{
if (_redisService.Exists(cacheKey.ToString()))
_redisService.DeleteKey(cacheKey.ToString());
}
_redisService.SetValue(cacheKey.ToString(), JsonConvert.SerializeObject(cacheObj));
return DataResult<string>.Success(string.Empty);
}
}
public enum SysCacheKeyEnum
{
/// <summary>
/// 船名基础信息
/// </summary>
[Description("船名基础信息")]
CommonCodeVessel,
/// <summary>
/// 港口基础信息
/// </summary>
[Description("港口基础信息")]
CommonCodePort,
/// <summary>
/// 包装基础信息
/// </summary>
[Description("包装基础信息")]
CommonCodePackage,
/// <summary>
/// 运输条款基础信息
/// </summary>
[Description("运输条款基础信息")]
CommonCodeService,
/// <summary>
/// 集装箱型基础信息
/// </summary>
[Description("集装箱型基础信息")]
CommonCodeCtn,
/// <summary>
/// 付费方式基础信息
/// </summary>
[Description("付费方式基础信息")]
CommonCodeFrt,
/// <summary>
/// 国家基础信息
/// </summary>
[Description("国家基础信息")]
CommonCodeCountry,
/// <summary>
/// 场站映射信息
/// </summary>
[Description("场站映射信息")]
CommonMappingYard,
/// <summary>
/// 集装箱型映射信息
/// </summary>
[Description("集装箱型映射信息")]
CommonMappingCtn,
/// <summary>
/// 船公司映射信息
/// </summary>
[Description("船公司映射信息")]
CommonMappingCarrier,
/// <summary>
/// 付费方式映射
/// </summary>
[Description("付费方式映射")]
CommonMappingFrt,
/// <summary>
/// 船名映射
/// </summary>
[Description("船名映射")]
CommonMappingVessel,
/// <summary>
/// 船代映射
/// </summary>
[Description("船代映射")]
CommonMappingForwarder
}
}

@ -0,0 +1,44 @@
using DS.Module.Core;
using DS.Module.RedisModule;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Code.Method;
using DS.WMS.Core.Sys.Interface;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Sys.Method
{
/// <summary>
///
/// </summary>
public class SysCommonCacheService: ISysCommonCacheService
{
private readonly IServiceProvider _serviceProvider;
private readonly IRedisService _redisService;
private readonly ICodeVesselService _codeVesselService;
public SysCommonCacheService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_redisService = _serviceProvider.GetRequiredService<IRedisService>();
_codeVesselService = _serviceProvider.GetRequiredService<ICodeVesselService>();
}
/// <summary>
/// 加载公共缓存数据
/// </summary>
/// <returns></returns>
public async Task<DataResult<string>> LoadCommonCache()
{
//SysCacheKeyEnum.CommonMappingVessel
var codeVessleRlt = await _codeVesselService.LoadCache();
return DataResult<string>.Success(string.Empty);
}
}
}

@ -8,10 +8,13 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using NLog;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@ -23,6 +26,8 @@ namespace DS.WMS.Core.Sys.Method
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly IWebHostEnvironment _environment;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>
///
/// </summary>
@ -112,5 +117,64 @@ namespace DS.WMS.Core.Sys.Method
.ToList();
return DataResult<List<SysFileRes>>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 保存文件并返回文件完整路径
/// </summary>
/// <param name="fileDictKey">文件目录KEY</param>
/// <param name="fileBytes">文件二进制流</param>
/// <param name="batchNo">批次号</param>
/// <param name="fileName">文件名称</param>
/// <param name="attachFileType">附件类型</param>
/// <returns></returns>
public async Task<DataResult<string>> SaveFileDirect(string fileDictKey, byte[] fileBytes, string batchNo,
string fileName, string attachFileType)
{
string fileRoot = AppSetting.app(new string[] { "FileSettings", "BasePath" });
string relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" });
if (!string.IsNullOrWhiteSpace(attachFileType))
relativePath += $"\\{attachFileType}";
if (!string.IsNullOrWhiteSpace(fileDictKey))
relativePath += $"\\{fileDictKey}";
relativePath += $"\\{DateTime.Now.ToString("yyyyMMddHHmmssfff")}";
string filePath = $"{fileRoot}\\{relativePath}";
string fileFullName = $"{filePath}\\{fileName}";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
relativePath = relativePath.Replace("\\", "/");
filePath = filePath.Replace("\\", "/");
fileFullName = fileFullName.Replace("\\", "/");
}
Logger.Log(NLog.LogLevel.Info, "批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath,
RuntimeInformation.OSDescription);
//预先创建目录
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
await File.WriteAllBytesAsync(fileFullName, fileBytes);
string bookFilePath = string.Empty;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("/", "\\/") + ".*").Value;
}
else
{
bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("\\", "\\\\") + ".*").Value;
}
return DataResult<string>.Success(bookFilePath);
}
}
}

@ -214,6 +214,17 @@ namespace DS.WMS.OpApi.Controllers
return await _spaceBookingMSKAPIService.GetInitInfo();
}
#endregion
/// <summary>
/// 获取预订舱途径选择
/// </summary>
/// <returns>返回结果</returns>
[HttpGet]
[Route("ChannelSelectShow")]
public async Task<DataResult<List<string>>> GetBookingChannelSelectShow()
{
return await _spaceBookingMSKAPIService.GetBookingChannelSelectShow();
}
}
}

@ -334,3 +334,31 @@
2024-07-15 11:55:56.3287 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-15 11:55:56.3370 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-15 11:55:56.3370 Info Configuration initialized.
2024-07-17 13:35:24.5417 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 13:35:24.5552 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 13:35:24.5552 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 13:35:24.6444 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 13:35:24.6552 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 13:35:24.6552 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 13:35:24.6678 Info Configuration initialized.
2024-07-17 13:36:20.7200 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 13:36:20.7312 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 13:36:20.7312 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 13:36:20.7429 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 13:36:20.7429 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 13:36:20.7429 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 13:36:20.7553 Info Configuration initialized.
2024-07-17 13:59:03.7262 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 13:59:03.7262 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 13:59:03.7399 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 13:59:03.7399 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 13:59:03.7399 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 13:59:03.7565 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 13:59:03.7565 Info Configuration initialized.
2024-07-17 14:01:25.4803 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 14:01:25.4922 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 14:01:25.4922 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 14:01:25.5048 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 14:01:25.5048 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:01:25.5048 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:01:25.5048 Info Configuration initialized.

@ -16,6 +16,8 @@ using Swashbuckle.AspNetCore.SwaggerUI;
using DS.Module.PrintModule;
using DS.Module.DjyRulesEngine;
using DS.Module.RedisModule;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.Sys.Method;
var builder = WebApplication.CreateBuilder(args);
var environment = builder.Environment.EnvironmentName;
@ -50,8 +52,10 @@ builder.Services.AddRedisModuleInstall();//redis
//builder.Services.AddCrawlerModuleInstall();//ÔË×Ù·þÎñ
var app = builder.Build();
// Configure the HTTP request pipeline.
// if (app.Environment.IsDevelopment())
// {
@ -91,4 +95,6 @@ app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
//await ServiceLocator.Instance.GetService<ISysCommonCacheService>().LoadCommonCache();
app.Run();

@ -93,5 +93,8 @@
},
"RedisInfo": {
"RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15"
},
"BCCompare": {
"Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare"
}
}

Loading…
Cancel
Save