usertest
zhangxiaofeng 3 months ago
commit 4ef404f39a

@ -40,8 +40,8 @@ namespace DS.Module.Core
/// <summary>
/// BC对比订单后是否存在差异
/// </summary>
/// <remarks>类型:CompareResultInfo</remarks>
public const string BcCompareWithSeaExportResult = "BcCompareWithSeaExportResult";
/// <remarks>类型:<see cref="bool" /></remarks>
public const string BcCompareBcWithSeaExportIsExistsDiff = "BcCompareBcWithSeaExportIsExistsDiff";
/// <summary>
/// BC文件

@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>http</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>D:\Code\DS\ds8-solution-pro\ds-wms-service\DS.WMS.AdminApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

@ -0,0 +1,77 @@
using DS.Module.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Code.Dtos
{
/// <summary>
/// 港口信息
/// </summary>
public class CodePortInfoRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 港口英文名称
/// </summary>
public string PortName { get; set; } = "";
/// <summary>
/// 港口中文名称
/// </summary>
public string CnName { get; set; } = "";
/// <summary>
/// 国家名称
/// </summary>
public string CountryName { get; set; } = "";
/// <summary>
/// 所在大洲
/// </summary>
public string Chau { get; set; } = "";
/// <summary>
/// 说明
/// </summary>
public string Explain { get; set; } = "";
/// <summary>
/// 港口类型
/// </summary>
public string PortType { get; set; } = "";
/// <summary>
/// 国家Id
/// </summary>
public long CountryId { get; set; } = 0;
/// <summary>
/// 航线Id
/// </summary>
public long LaneId { get; set; } = 0;
/// <summary>
/// 航线代码
/// </summary>
public string LaneCode { get; set; }
/// <summary>
/// 航线
/// </summary>
public string Lane { get; set; }
/// <summary>
/// EDI代码
/// </summary>
public string EdiCode { get; set; } = "";
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}

@ -0,0 +1,124 @@
using DS.Module.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Info.Dtos
{
/// <summary>
/// 委托单位下拉返回信息
/// </summary>
public class ControllerClientRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// Desc:客户代码
/// </summary>
public string CodeName { get; set; }
/// <summary>
/// Desc:客户简称
/// </summary>
public string ShortName { get; set; }
/// <summary>
/// Desc:英文简称
/// </summary>
public string EnShortName { get; set; }
/// <summary>
/// Desc:提单信息
/// </summary>
public string BLContent { get; set; }
/// <summary>
/// 助记码
/// </summary>
public string PinYinCode { get; set; }
/// <summary>
/// Desc:业务来源Id
/// </summary>
public long SourceId { get; set; }
/// <summary>
/// Desc:业务来源明细Id
/// </summary>
public long SourceDetailId { get; set; }
/// <summary>
/// Desc:业务来源名称
/// </summary>
public string SourceName { get; set; }
/// <summary>
/// Desc:业务来源明细名称
/// </summary>
public string SourceDetailName { get; set; }
/// <summary>
/// Desc:所属揽货人
/// </summary>
public long SaleId { get; set; }
/// <summary>
/// Desc:所属操作人
/// </summary>
public long Op { get; set; }
/// <summary>
/// Desc:所属单证
/// </summary>
public long Doc { get; set; }
/// <summary>
/// Desc: 客服
/// </summary>
public long CustomerService { get; set; }
/// <summary>
/// 揽货人名字
/// </summary>
public string SaleName { get; set; }
/// <summary>
/// 操作名字
/// </summary>
public string OpName { get; set; }
/// <summary>
/// 单证名字
/// </summary>
public string DocName { get; set; }
/// <summary>
/// 客服名字
/// </summary>
public string CustomerServiceName { get; set; }
/// <summary>
/// 所属分部值
/// </summary>
[IgnoreDataMember]
public string? SaleOrgId { get; set; }
/// <summary>
/// 所属分部
/// </summary>
public long[] SaleOrgIdList => SaleOrgId.IsNullOrEmpty() ? [] :
SaleOrgId.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
/// <summary>
/// 所属集团ID
/// </summary>
public long? PcorpId { get; set; }
/// <summary>
/// Desc: 所属集团
/// </summary>
public string PcorpName { get; set; }
}
}

@ -490,35 +490,5 @@ namespace DS.WMS.Core.Op.Dtos
/// 还箱场站
/// </summary>
public string ReturnCTNYard { get; set; }
/// <summary>
/// 温度单位
/// </summary>
public string TempUnit{ get; set; }
/// <summary>
/// 设置温度
/// </summary>
public string TempSet { get; set; }
/// <summary>
/// 最低温度
/// </summary>
public string TempMin { get; set; }
/// <summary>
/// 最高温度
/// </summary>
public string TempMax { get; set; }
/// <summary>
/// 湿度
/// </summary>
public string Humidity { get; set; }
/// <summary>
/// 冷藏通风量
/// </summary>
public string Reeferf { get; set; }
}
}

@ -1220,6 +1220,16 @@ public class SeaExportReq
/// Desc:业务来源明细名称
/// </summary>
public string SourceDetailName { get; set; }
/// <summary>
/// 航线人员Id
/// </summary>
public long? LanerId { get; set; }
/// <summary>
/// 航线人员名称
/// </summary>
public string Laner { get; set; }
}
/// <summary>

@ -1417,4 +1417,15 @@ public class SeaExportRes
/// Desc:运踪状态 虚值
/// </summary>
public string BookStatus { get; set; }
/// <summary>
/// 航线人员Id
/// </summary>
public long? LanerId { get; set; }
/// <summary>
/// 航线人员名称
/// </summary>
public string Laner { get; set; }
}

@ -1599,4 +1599,18 @@ public class SeaExport : BaseOrgModel<long>
/// </summary>
[SugarColumn(ColumnDescription = "业务来源明细名称", Length = 100, IsNullable = true)]
public string SourceDetailName { get; set; }
/// <summary>
/// 航线人员Id
/// </summary>
[SugarColumn(ColumnDescription = "航线人员Id", IsNullable = true)]
public long? LanerId { get; set; }
/// <summary>
/// 航线人员名称
/// </summary>
[SugarColumn(ColumnDescription = "航线人员名称", IsNullable = true, Length = 100)]
public string Laner { get; set; }
}

@ -7,6 +7,9 @@ using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using DS.WMS.Core.Sys.Interface;
using DS.Module.UserModule;
using DS.WMS.Core.Sys.Entity;
namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
{
@ -15,29 +18,36 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
/// </summary>
public class SpaceReleaseActionExecutor : DefaultActionExecutor
{
/// <summary>
/// 任务服务
/// </summary>
protected ISeaExportService OpService;
///// <summary>
///// 任务服务
///// </summary>
//protected ISeaExportService OpService;
/// <summary>
/// 日志服务
/// </summary>
protected ITaskLogService LogService;
/// <summary>
/// 客户参数服务
/// </summary>
protected IClientParamService ClientParamService;
public override async Task ExecuteAsync(ActionExecutionContext context)
{
OpService = context.ServiceProvider.GetRequiredService<ISeaExportService>();
//OpService = context.ServiceProvider.GetRequiredService<ISeaExportService>();
LogService = context.ServiceProvider.GetRequiredService<ITaskLogService>();
ClientParamService = context.ServiceProvider.GetRequiredService<IClientParamService>();
var releaseTypeService = context.ServiceProvider.GetRequiredService<IReleaseTypeService>();
var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType);
switch (typeValue)
{
case SpaceReleaseType.RelayBC:
await RelayBCAsync(context);
break;
case SpaceReleaseType.IncomingNotification:
await SendIncomingNotificationAsync(context);
break;
}
var param2 = await ClientParamService.GetParamAsync<bool?>(context.TaskInfo.BusinessId, "SendXHZ", (x, y) => x.CustomerId == y.YardId);
var clientParamService = context.ServiceProvider.GetRequiredService<IClientParamService>();
var param = await clientParamService.GetParamAsync<bool?>(context.TaskInfo.BusinessId, "SendXHZ", (x, y) => x.CustomerId == y.YardId);
if (param.Value.GetValueOrDefault())
await SendShippingOrderAsync(context);
}
//入货通知
@ -93,9 +103,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
}
//转发BC
async Task RelayBCAsync(ActionExecutionContext context)
async Task RelayBCAsync(ActionExecutionContext context)
{
}
//下货纸
@ -114,5 +124,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
}
}

@ -527,7 +527,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (useTransaction)
await TenantDb.Ado.CommitTranAsync();
//ActionService.Value.TriggerActionAsync(task);
ActionService.TriggerActionAsync(task);
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? await GetNextTypeAsync(task) : null);
}
catch (Exception ex)

@ -164,7 +164,10 @@ public class UserReq
/// 用戶航线
/// </summary>
public long?[] LaneIds { get; set; }
/// <summary>
/// 是否航线操作人员
/// </summary>
public bool IsLaner { get; set; } = false;
/// <summary>
/// 业务来源Id
/// </summary>

@ -199,4 +199,9 @@ public class UserViewModel
/// 邮件签名
/// </summary>
public string SignatureHtml { get; set; } = "";
/// <summary>
/// 是否航线操作人员
/// </summary>
public bool IsLaner { get; set; } = false;
}

@ -11,11 +11,23 @@ namespace DS.WMS.Core.Sys.Entity
[SugarTable("sys_release_type")]
public class SysReleaseType : BaseModelV2<long>
{
/// <summary>
/// 委托单位ID
/// </summary>
[SugarColumn(ColumnDescription = "委托单位ID", IsNullable = true)]
public long? CustomerId { get; set; }
/// <summary>
/// 委托单位名称
/// </summary>
[SugarColumn(IsIgnore = true)]
public string? CustomerName { get; set; }
/// <summary>
/// 承运商(船公司/航空公司)
/// </summary>
[SugarColumn(ColumnDescription = "承运商(船公司/航空公司)", Length = 50, IsNullable = false)]
public string Carrier { get; set; } = string.Empty;
[SugarColumn(ColumnDescription = "承运商(船公司/航空公司)", Length = 50, IsNullable = true)]
public string? Carrier { get; set; }
/// <summary>
/// 起运港代码

@ -206,7 +206,11 @@ public class SysUser : UserTenantModel<long>
/// </summary>
[Description("是否派车调度人员")]
public bool IsDispatcher { get; set; } = false;
/// <summary>
/// 是否航线操作人员
/// </summary>
[Description("是否航线操作人员")]
public bool IsLaner { get; set; } = false;
/// <summary>
/// 签名图片
/// </summary>

@ -14,6 +14,21 @@ namespace DS.WMS.Core.Sys.Interface;
/// </summary>
public interface IClientCommonService
{
/// <summary>
/// 根据五字码获取港口信息-客户端
/// </summary>
/// <returns></returns>
public Task<DataResult<CodePortInfoRes>> GetClientPortSelectList(string queryKey = "");
/// <summary>
/// 获取航线操作员列表
/// </summary>
/// <returns></returns>
public Task<DataResult<List<UserSelectRes>>> GetLaneUserList(string queryKey = "");
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
public Task<DataResult<List<ControllerClientRes>>> GetControllerClientList(string queryKey = "");
/// <summary>
/// 获取船公司下拉列表
/// </summary>

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
namespace DS.WMS.Core.Sys.Interface
@ -16,6 +17,14 @@ namespace DS.WMS.Core.Sys.Interface
/// <returns></returns>
Task<DataResult<List<SysReleaseType>>> GetListAsync(PageRequest request, bool isAdmin = false);
/// <summary>
/// 根据业务数据匹配放舱方式
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<SpaceReleaseType?> GetReleaseTypeAsync(long businessId, BusinessType businessType);
/// <summary>
/// 详情
/// </summary>

@ -47,6 +47,54 @@ public class ClientCommonService : IClientCommonService
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 根据五字码获取港口信息-客户端
/// </summary>
/// <returns></returns>
public async Task<DataResult<CodePortInfoRes>> GetClientPortSelectList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable<CodePort>()
.Where(x => x.Status == StatusEnum.Enable && x.EdiCode == queryKey.Trim())
.Select<CodePortInfoRes>()
.FirstAsync();
return await Task.FromResult(DataResult<CodePortInfoRes>.Success("获取数据成功!", data));
}
/// <summary>
/// 获取航线操作员列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<UserSelectRes>>> GetLaneUserList(string queryKey = "")
{
var data = await db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsLaner == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.Take(20)
.WithCache($"{SqlSugarCacheConst.User}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<ControllerClientRes>>> GetControllerClientList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey))
.Select((a, b) => new ControllerClientRes
{
Id = a.Id,
PinYinCode = a.ShortName + "(" + a.CodeName + ")"
},true
).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync();
return await Task.FromResult(DataResult<List<ControllerClientRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
/// <summary>
/// 获取船公司下拉列表
/// </summary>

@ -1,5 +1,9 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
@ -16,6 +20,7 @@ namespace DS.WMS.Core.Sys.Method
/// <param name="provider"></param>
public ReleaseTypeService(IServiceProvider provider) : base(provider)
{
TenantDb.QueryFilter.Clear<IOrgId>();
}
/// <summary>
@ -28,12 +33,73 @@ namespace DS.WMS.Core.Sys.Method
{
var whereList = request.GetConditionalModels(Db);
var tenantId = long.Parse(User.TenantId);
var data = await Db.Queryable<SysReleaseType>().Where(whereList)
.WhereIF(!isAdmin, x => x.TenantId == tenantId)
var data = await Db.Queryable<SysReleaseType>()
.Where(whereList).WhereIF(!isAdmin, x => x.TenantId == tenantId)
.ToQueryPageAsync(request.PageCondition);
if (data.Data?.Count > 0)
{
var ids = data.Data.Where(x => x.CustomerId.HasValue).Select(x => x.CustomerId.Value);
var list = await TenantDb.Queryable<InfoClient>().Where(x => ids.Contains(x.Id)).Select(x => new { x.Id, x.ShortName }).ToListAsync();
foreach (var item in data.Data)
item.CustomerName = list.Find(x => x.Id == item.CustomerId)?.ShortName;
}
return data;
}
/// <summary>
/// 根据业务数据匹配放舱方式
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
public async Task<SpaceReleaseType?> GetReleaseTypeAsync(long businessId, BusinessType businessType)
{
SpaceReleaseType? releaseType = null;
switch (businessType)
{
case BusinessType.OceanShippingExport:
var order1 = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == businessId)
.LeftJoin<CodeCarrier>((x, y) => x.CarrierId == y.Id)
.Select((x, y) => new
{
x.CustomerId,
x.LoadPortCode,
CarrierCode = y.Code
}).FirstAsync();
if (order1 == null)
return null;
long tid = long.Parse(User.TenantId);
var list = await Db.Queryable<SysReleaseType>().Where(x => x.TenantId == tid && x.CustomerId == order1.CustomerId && x.LoadingPort == order1.LoadPortCode)
.Select(x => new { x.Carrier, x.ReleaseType }).ToListAsync();
var clientItem = list.Find(x => x.Carrier == order1.CarrierCode);
if (clientItem != null)
return clientItem.ReleaseType;
if (list.Count > 0) //返回默认船公司的配置
return list[0].ReleaseType;
//租户端无匹配的设置,需要从管理端获取全局参数
var list2 = await Db.Queryable<SysReleaseType>().Where(x => x.TenantId == null && x.LoadingPort == order1.LoadPortCode)
.Select(x => new { x.Carrier, x.ReleaseType }).ToListAsync();
var adminItem = list2.Find(x => x.Carrier == order1.CarrierCode);
if (adminItem != null)
return adminItem.ReleaseType;
if (list2.Count > 0)
return list[0].ReleaseType;
break;
case BusinessType.OceanShippingImport:
break;
}
return releaseType;
}
/// <summary>
/// 详情
/// </summary>
@ -61,9 +127,10 @@ namespace DS.WMS.Core.Sys.Method
{
rows = await Db.Updateable(entity).UpdateColumns(x => new
{
x.CustomerId,
x.Carrier,
x.LoadingPort,
x.ReleaseType,
x.ReleaseType
}).ExecuteCommandAsync();
}

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.TaskPlat
{
/// <summary>
///
/// </summary>
public class BCReadResultDto
{
/// <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 summary { get; set; }
/// <summary>
/// 扩展信息
/// </summary>
public object extra { get; set; }
/// <summary>
/// 扩展信息2
/// </summary>
public object extra2 { get; set; }
/// <summary>
/// 扩展信息场站统计
/// </summary>
public object yardStatInfo { get; set; }
/// <summary>
/// 是否异常
/// </summary>
public bool exceptionflag { get; set; }
/// <summary>
/// 生成HTML
/// </summary>
public string ResultHtml { get; set; }
}
}

@ -4,6 +4,7 @@ using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.TaskPlat.Dtos;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
namespace DS.WMS.Core.TaskPlat.Interface
{
@ -49,6 +50,22 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// </summary>
Task<DataResult<CompareResultInfo>> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext);
/// <summary>
/// 读取BC详情
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
Task<DataResult<ParserBCInfoDto>> GetReadBC(string carrierCode, IFormFile file);
/// <summary>
/// 读取BC擦写后文件流
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
Task<DataResult<byte[]>> GetModifyBCFile(string carrierCode, IFormFile file);
/// <summary>
/// 通过BC任务匹配订单任务台使用
/// </summary>

@ -25,12 +25,16 @@ using DS.WMS.Core.TaskPlat.Interface;
using HtmlAgilityPack;
using Mapster;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NLog;
using SqlSugar;
using System.Web;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Text;
namespace DS.WMS.Core.TaskPlat.Method
{
@ -50,6 +54,11 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly IWebHostEnvironment _environment;
private readonly ISqlSugarClient db;
private readonly string bcCompareUrl;
private readonly string bcMSKReadUrl;
private readonly string bcMSKModifyFileUrl;
private readonly string bcCMAReadUrl;
// 按需构建
private Lazy<IBookingSlotService> bookingSlotService;
private Lazy<ISeaExportService> seaExportService;
@ -65,6 +74,7 @@ namespace DS.WMS.Core.TaskPlat.Method
//自动转发是否默认抄送操作
const string CONST_AUTO_TRANS_EMAIL_OP_CCTO = "AUTO_TRANS_EMAIL_OP_CCTO";
public TaskManageBCService(IUser user,
ILogger<TaskManageBCService> logger,
@ -97,6 +107,11 @@ namespace DS.WMS.Core.TaskPlat.Method
tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
tenantDb.QueryFilter.Clear<IOrgId>();
bcCompareUrl = AppSetting.app(new string[] { "BCCompare", "Url" });
bcMSKReadUrl = AppSetting.app(new string[] { "BCCompare", "MSKBCReadUrl" });
bcMSKModifyFileUrl = AppSetting.app(new string[] { "BCCompare", "MSKBCModifyFileUrl" });
bcCMAReadUrl = AppSetting.app(new string[] { "BCCompare", "CMABCReadUrl" });
}
/// <summary>
@ -1121,12 +1136,12 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <summary>
/// 对比BC与海运出口订单任务台使用
/// </summary>
public async Task<DataResult<CompareResultInfo>> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext)
public async Task<DataResult<(bool isExistsDiff, List<CompareResultDetailInfo>)>> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext)
{
var taskBcInfo = dataContext.Get<TaskBCInfo?>(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}");
var taskBcCtnList = dataContext.Get<List<TaskBCCTNInfo>?>(TaskFlowDataNameConst.TaskBCCtnList) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCCtnList)}");
var seaExport = await tenantDb.Queryable<SeaExport>().Where(x => x.ParentId == 0 && taskBcInfo.MBL_NO == x.MBLNO).Select(x => new SeaExport()
var seaExport = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID).Select(x => new SeaExport()
{
Id = x.Id,
MBLNO = x.MBLNO,
@ -1159,19 +1174,18 @@ namespace DS.WMS.Core.TaskPlat.Method
SeaExport = seaExport,
OpCtnList = seaExportCtnList
};
var result = await CompareBcWithSeaExport(compareDto);
(bool isExistsDiff, List<CompareResultDetailInfo>) result = await CompareBcWithSeaExport(compareDto);
dataContext.Set(TaskFlowDataNameConst.BcCompareWithSeaExportResult, result);
dataContext.Set(TaskFlowDataNameConst.BcCompareBcWithSeaExportIsExistsDiff, result.isExistsDiff);
return DataResult<CompareResultInfo>.Success(result);
return DataResult<(bool isExistsDiff, List<CompareResultDetailInfo>)>.Success(result);
}
/// <summary>
/// 对比BC与海运出口订单
/// </summary>
public async Task<CompareResultInfo> CompareBcWithSeaExport(CompareBcWithSeaExportDto compareDto)
public async Task<(bool isExistsDiff, List<CompareResultDetailInfo>)> CompareBcWithSeaExport(CompareBcWithSeaExportDto compareDto)
{
var taskBcInfo = compareDto.TaskBCInfo;
var taskBcCtnList = compareDto.TaskBCCtnList;
var seaExport = compareDto.SeaExport;
@ -1243,7 +1257,7 @@ namespace DS.WMS.Core.TaskPlat.Method
logger.LogInformation($"批次={batchNo} taskBcInfo.id={taskBcInfo.Id} seaExport.id={seaExport.Id} 请求BC对比订单结果完成耗时{timeDiff}ms是否成功{(compareResult?.succ == true ? "" : "")} ");
if (compareResult != null && compareResult?.succ == true)
if (compareResult != null)
{
logger.LogInformation($"批次={batchNo} BC对比订单结果={JsonConvert.SerializeObject(compareResult)}");
DateTime nowDate = DateTime.Now;
@ -1289,22 +1303,13 @@ namespace DS.WMS.Core.TaskPlat.Method
it.UpdateUserName
}).ExecuteCommandAsync();
}
return new CompareResultInfo()
{
IsExistsDiff = compareResult.extra.IsExistsDiff,
ShowDetailList = compareResult.extra.ShowDetailList,
DetailList = compareResult.extra.DetailList,
IsSuccess = true
};
//return (compareResult.extra.IsExistsDiff, compareResult.extra.ShowDetailList);
return (compareResult.extra.IsExistsDiff, compareResult.extra.ShowDetailList);
}
else
{
logger.LogError($"批次={batchNo} BC对比订单结果为空");
return new CompareResultInfo()
{
IsSuccess = false
};
throw new Exception($"批次={batchNo} BC对比订单结果为空");
}
}
@ -2271,5 +2276,163 @@ namespace DS.WMS.Core.TaskPlat.Method
return await SyncBookingSlotChange(taskBaseId.Value);
}
#region 读取BC详情
/// <summary>
/// 读取BC详情
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
public async Task<DataResult<ParserBCInfoDto>> GetReadBC(string carrierCode, IFormFile file)
{
DateTime nowDate = DateTime.Now;
string msg = string.Empty;
var messageInfo = new
{
Head = new
{
GID = SnowFlakeSingle.Instance.NextId().ToString(),
MessageType = "BOOKING_GAMENDMENT",
SenderId = AppSetting.app(new string[] { "ExcuteRuleService", "RulesEngineSender" }),
SenderName = AppSetting.app(new string[] { "ExcuteRuleService", "RulesEngineSenderName" }),
ReceiverId = "RulesEngine",
ReceiverName = "大简云规则引擎",
Version = "1.0",
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "ReadFile",
},
Main = new
{
TenantId = user.TenantId.ToString()
}
};
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(messageInfo)));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "jsonData"
};
reduceAttach.Add(dataContent);
#region 文件参数
if (file != null)
{
var Content = new ByteArrayContent(file.ToByteArray());
Content.Headers.Add("Content-Type", "application/json");
reduceAttach.Add(Content, "file", HttpUtility.UrlEncode(file.FileName));
}
#endregion
var url = string.Empty;
if (carrierCode.Equals("MSK", StringComparison.OrdinalIgnoreCase))
url = bcMSKReadUrl;
if (carrierCode.Equals("CMA", StringComparison.OrdinalIgnoreCase))
url = bcCMAReadUrl;
//请求
var response = httpClient.PostAsync(url, reduceAttach).Result;
string result = response.Content.ReadAsStringAsync().Result;
var model = JsonConvert.DeserializeObject<BCReadResultDto>(result);
if(model != null && model.succ)
{
var bcInfo = JsonConvert.DeserializeObject<ParserBCInfoDto>(JsonConvert.SerializeObject(model.extra));
return DataResult<ParserBCInfoDto>.Success(bcInfo);
}
else
{
msg = model.msg;
}
}
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Info, "请求BC读取详情异常原因{error}", ex.Message);
msg = $"请求BC读取详情异常原因{ex.Message}";
}
return DataResult<ParserBCInfoDto>.Failed(msg);
}
}
#endregion
#region 读取BC擦写后文件流
/// <summary>
/// 读取BC擦写后文件流
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
public async Task<DataResult<byte[]>> GetModifyBCFile(string carrierCode, IFormFile file)
{
byte[] bytes;
var result = string.Empty;
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(""));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "jsonData"
};
reduceAttach.Add(dataContent);
#region 文件参数
if (file != null)
{
var Content = new ByteArrayContent(file.ToByteArray());
Content.Headers.Add("Content-Type", "application/json");
reduceAttach.Add(Content, "file", HttpUtility.UrlEncode(file.FileName));
}
#endregion
//请求
var response = httpClient.PostAsync(bcMSKModifyFileUrl, reduceAttach).Result;
bytes = response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult();
return DataResult<byte[]>.Success(bytes);
}
}
catch (Exception ex)
{
Logger.Log(NLog.LogLevel.Info, "请求自动变更文件内容异常,原因:{error}", ex.Message);
result = $"请求自动变更文件内容异常,原因:{ex.Message}";
}
}
return DataResult<byte[]>.Failed(result);
}
#endregion
}
}

@ -28,7 +28,42 @@ public class ClientCommonController : ApiController
{
_invokeService = invokeService;
}
/// <summary>
/// 根据五字码获取港口信息-客户端
/// </summary>
/// <param name="queryKey">港口五字码</param>
/// <returns></returns>
[HttpGet]
[Route("GetClientPortSelectList")]
public async Task<DataResult<CodePortInfoRes>> GetClientPortSelectList([FromQuery] string queryKey)
{
var res = await _invokeService.GetClientPortSelectList(queryKey);
return res;
}
/// <summary>
/// 获取航线操作员列表-客户端
/// </summary>
/// <param name="queryKey">用户代码或中文名称</param>
/// <returns></returns>
[HttpGet]
[Route("GetLaneUserList")]
public async Task<DataResult<List<UserSelectRes>>> GetLaneUserList([FromQuery] string queryKey)
{
var res = await _invokeService.GetLaneUserList(queryKey);
return res;
}
/// <summary>
/// 获取委托单位下拉列表-客户端
/// </summary>
/// <param name="queryKey">委托单位代码或中文名称</param>
/// <returns></returns>
[HttpGet]
[Route("GetControllerClientList")]
public async Task<DataResult<List<ControllerClientRes>>> GetControllerClientList([FromQuery] string queryKey)
{
var res = await _invokeService.GetControllerClientList(queryKey);
return res;
}
/// <summary>
/// 获取船公司下拉列表-客户端
/// </summary>

@ -59,6 +59,9 @@ namespace DS.WMS.MainApi.Controllers
if (entity == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.IllegalRequest));
if (entity.CustomerId == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.IllegalRequest) + " " + nameof(entity.CustomerId));
entity.TenantId = long.Parse(user.TenantId);
entity.TenantName = user.TenantName;

@ -68,5 +68,33 @@ namespace DS.WMS.TaskApi.Controllers
return await _taskManageBCService.SyncBookingSlotChange(taskPKId);
}
#endregion
#region 读取BC详情
/// <summary>
/// 读取BC详情
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
[HttpPost("GetReadBC")]
public async Task<DataResult<ParserBCInfoDto>> GetReadBC(string carrierCode, IFormFile file)
{
return await _taskManageBCService.GetReadBC(carrierCode, file);
}
#endregion
#region 读取BC擦写后文件流
/// <summary>
/// 读取BC擦写后文件流
/// </summary>
/// <param name="carrierCode">船公司代码</param>
/// <param name="file">BC文件</param>
/// <returns>返回解析详情</returns>
[HttpPost("GetModifyBCFile")]
public async Task<DataResult<byte[]>> GetModifyBCFile(string carrierCode, IFormFile file)
{
return await _taskManageBCService.GetModifyBCFile(carrierCode, file);
}
#endregion
}
}

@ -66,7 +66,10 @@
"FileType": [ ".xls", ".xlsx", ".pdf", ".txt", ".pms" ]
},
"BCCompare": {
"Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare"
"Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare",
"MSKBCReadUrl": "http://47.104.73.97:7115/api/TaskBCParser/ExcuteBCFileRead",
"MSKBCModifyFileUrl": "http://47.104.73.97:7115/api/TaskBCParser/ModifyBCFile",
"CMABCReadUrl": "http://47.104.73.97:7115/api/TaskBCCMAParser/ExcuteBCFileRead"
},
"ShippingOrderCompare": {
"Url": "http://47.104.73.97:7115/api/TaskShippingOrderCompare/ExcuteShippingOrderCompare",

Loading…
Cancel
Save