diff --git a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs index 2e52564e..8ccd5643 100644 --- a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs @@ -40,8 +40,8 @@ namespace DS.Module.Core /// /// BC对比订单后是否存在差异 /// - /// 类型:CompareResultInfo - public const string BcCompareWithSeaExportResult = "BcCompareWithSeaExportResult"; + /// 类型: + public const string BcCompareBcWithSeaExportIsExistsDiff = "BcCompareBcWithSeaExportIsExistsDiff"; /// /// BC文件 diff --git a/ds-wms-service/DS.WMS.AdminApi/DS.WMS.AdminApi.csproj.user b/ds-wms-service/DS.WMS.AdminApi/DS.WMS.AdminApi.csproj.user index 93bef62e..4341ebc7 100644 --- a/ds-wms-service/DS.WMS.AdminApi/DS.WMS.AdminApi.csproj.user +++ b/ds-wms-service/DS.WMS.AdminApi/DS.WMS.AdminApi.csproj.user @@ -2,7 +2,7 @@ http - D:\Code\DS\ds8-solution-pro\ds-wms-service\DS.WMS.AdminApi\Properties\PublishProfiles\FolderProfile.pubxml + D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\Properties\PublishProfiles\FolderProfile.pubxml ProjectDebugger diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodePortInfoRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodePortInfoRes.cs new file mode 100644 index 00000000..f1a5d421 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodePortInfoRes.cs @@ -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 +{ + /// + /// 港口信息 + /// + public class CodePortInfoRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 港口英文名称 + /// + public string PortName { get; set; } = ""; + /// + /// 港口中文名称 + /// + public string CnName { get; set; } = ""; + /// + /// 国家名称 + /// + public string CountryName { get; set; } = ""; + /// + /// 所在大洲 + /// + public string Chau { get; set; } = ""; + /// + /// 说明 + /// + public string Explain { get; set; } = ""; + /// + /// 港口类型 + /// + public string PortType { get; set; } = ""; + + /// + /// 国家Id + /// + public long CountryId { get; set; } = 0; + /// + /// 航线Id + /// + public long LaneId { get; set; } = 0; + /// + /// 航线代码 + /// + public string LaneCode { get; set; } + /// + /// 航线 + /// + public string Lane { get; set; } + /// + /// EDI代码 + /// + public string EdiCode { get; set; } = ""; + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Info/Dtos/ControllerClientRes.cs b/ds-wms-service/DS.WMS.Core/Info/Dtos/ControllerClientRes.cs new file mode 100644 index 00000000..a1d2331e --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Dtos/ControllerClientRes.cs @@ -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 +{ + /// + /// 委托单位下拉返回信息 + /// + public class ControllerClientRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + + + /// + /// Desc:客户代码 + /// + public string CodeName { get; set; } + + /// + /// Desc:客户简称 + /// + public string ShortName { get; set; } + + + /// + /// Desc:英文简称 + /// + public string EnShortName { get; set; } + + /// + /// Desc:提单信息 + /// + public string BLContent { get; set; } + + /// + /// 助记码 + /// + public string PinYinCode { get; set; } + + /// + /// Desc:业务来源Id + /// + public long SourceId { get; set; } + /// + /// Desc:业务来源明细Id + /// + public long SourceDetailId { get; set; } + /// + /// Desc:业务来源名称 + /// + public string SourceName { get; set; } + /// + /// Desc:业务来源明细名称 + /// + public string SourceDetailName { get; set; } + /// + /// Desc:所属揽货人 + /// + public long SaleId { get; set; } + + /// + /// Desc:所属操作人 + /// + public long Op { get; set; } + + /// + /// Desc:所属单证 + /// + public long Doc { get; set; } + + /// + /// Desc: 客服 + /// + public long CustomerService { get; set; } + /// + /// 揽货人名字 + /// + public string SaleName { get; set; } + + /// + /// 操作名字 + /// + public string OpName { get; set; } + + /// + /// 单证名字 + /// + public string DocName { get; set; } + + /// + /// 客服名字 + /// + public string CustomerServiceName { get; set; } + + /// + /// 所属分部值 + /// + [IgnoreDataMember] + public string? SaleOrgId { get; set; } + + /// + /// 所属分部 + /// + public long[] SaleOrgIdList => SaleOrgId.IsNullOrEmpty() ? [] : + SaleOrgId.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray(); + /// + /// 所属集团ID + /// + public long? PcorpId { get; set; } + + /// + /// Desc: 所属集团 + /// + public string PcorpName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ParserBCInfoDto.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ParserBCInfoDto.cs index 2568640a..0d14e657 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ParserBCInfoDto.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ParserBCInfoDto.cs @@ -490,35 +490,5 @@ namespace DS.WMS.Core.Op.Dtos /// 还箱场站 /// public string ReturnCTNYard { get; set; } - - /// - /// 温度单位 - /// - public string TempUnit{ get; set; } - - /// - /// 设置温度 - /// - public string TempSet { get; set; } - - /// - /// 最低温度 - /// - public string TempMin { get; set; } - - /// - /// 最高温度 - /// - public string TempMax { get; set; } - - /// - /// 湿度 - /// - public string Humidity { get; set; } - - /// - /// 冷藏通风量 - /// - public string Reeferf { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs index b76d5626..b49b8349 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs @@ -1220,6 +1220,16 @@ public class SeaExportReq /// Desc:业务来源明细名称 /// public string SourceDetailName { get; set; } + + /// + /// 航线人员Id + /// + public long? LanerId { get; set; } + + /// + /// 航线人员名称 + /// + public string Laner { get; set; } } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs index 027398dd..d02ea83e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs @@ -1417,4 +1417,15 @@ public class SeaExportRes /// Desc:运踪状态 虚值 /// public string BookStatus { get; set; } + + + /// + /// 航线人员Id + /// + public long? LanerId { get; set; } + + /// + /// 航线人员名称 + /// + public string Laner { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs index f8031801..42f44bff 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs @@ -1599,4 +1599,18 @@ public class SeaExport : BaseOrgModel /// [SugarColumn(ColumnDescription = "业务来源明细名称", Length = 100, IsNullable = true)] public string SourceDetailName { get; set; } + + + + /// + /// 航线人员Id + /// + [SugarColumn(ColumnDescription = "航线人员Id", IsNullable = true)] + public long? LanerId { get; set; } + + /// + /// 航线人员名称 + /// + [SugarColumn(ColumnDescription = "航线人员名称", IsNullable = true, Length = 100)] + public string Laner { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs index 7676c1ab..bb488c0b 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs @@ -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 /// public class SpaceReleaseActionExecutor : DefaultActionExecutor { - /// - /// 任务服务 - /// - protected ISeaExportService OpService; + ///// + ///// 任务服务 + ///// + //protected ISeaExportService OpService; /// /// 日志服务 /// protected ITaskLogService LogService; - /// - /// 客户参数服务 - /// - protected IClientParamService ClientParamService; - public override async Task ExecuteAsync(ActionExecutionContext context) { - OpService = context.ServiceProvider.GetRequiredService(); + //OpService = context.ServiceProvider.GetRequiredService(); LogService = context.ServiceProvider.GetRequiredService(); - ClientParamService = context.ServiceProvider.GetRequiredService(); - + var releaseTypeService = context.ServiceProvider.GetRequiredService(); + 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(context.TaskInfo.BusinessId, "SendXHZ", (x, y) => x.CustomerId == y.YardId); + var clientParamService = context.ServiceProvider.GetRequiredService(); + var param = await clientParamService.GetParamAsync(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 } - + } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 0dc5dad8..98ee11ab 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -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.Success(task.TaskStatus == TaskStatusEnum.Complete ? await GetNextTypeAsync(task) : null); } catch (Exception ex) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs index ed8920a3..7c37552c 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserReq.cs @@ -164,7 +164,10 @@ public class UserReq /// 用戶航线 /// public long?[] LaneIds { get; set; } - + /// + /// 是否航线操作人员 + /// + public bool IsLaner { get; set; } = false; /// /// 业务来源Id /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs index 408bb4da..2fa03142 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs @@ -199,4 +199,9 @@ public class UserViewModel /// 邮件签名 /// public string SignatureHtml { get; set; } = ""; + + /// + /// 是否航线操作人员 + /// + public bool IsLaner { get; set; } = false; } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysReleaseType.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysReleaseType.cs index 0e4118ab..93aa7ef3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysReleaseType.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysReleaseType.cs @@ -11,11 +11,23 @@ namespace DS.WMS.Core.Sys.Entity [SugarTable("sys_release_type")] public class SysReleaseType : BaseModelV2 { + /// + /// 委托单位ID + /// + [SugarColumn(ColumnDescription = "委托单位ID", IsNullable = true)] + public long? CustomerId { get; set; } + + /// + /// 委托单位名称 + /// + [SugarColumn(IsIgnore = true)] + public string? CustomerName { get; set; } + /// /// 承运商(船公司/航空公司) /// - [SugarColumn(ColumnDescription = "承运商(船公司/航空公司)", Length = 50, IsNullable = false)] - public string Carrier { get; set; } = string.Empty; + [SugarColumn(ColumnDescription = "承运商(船公司/航空公司)", Length = 50, IsNullable = true)] + public string? Carrier { get; set; } /// /// 起运港代码 diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs index 109542e8..f4ced2ae 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysUser.cs @@ -206,7 +206,11 @@ public class SysUser : UserTenantModel /// [Description("是否派车调度人员")] public bool IsDispatcher { get; set; } = false; - + /// + /// 是否航线操作人员 + /// + [Description("是否航线操作人员")] + public bool IsLaner { get; set; } = false; /// /// 签名图片 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs index 827f89cf..66cd0d7f 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs @@ -14,6 +14,21 @@ namespace DS.WMS.Core.Sys.Interface; /// public interface IClientCommonService { + /// + /// 根据五字码获取港口信息-客户端 + /// + /// + public Task> GetClientPortSelectList(string queryKey = ""); + /// + /// 获取航线操作员列表 + /// + /// + public Task>> GetLaneUserList(string queryKey = ""); + /// + /// 获取委托单位下拉列表 + /// + /// + public Task>> GetControllerClientList(string queryKey = ""); /// /// 获取船公司下拉列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IReleaseTypeService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IReleaseTypeService.cs index 95637dca..ac53108e 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IReleaseTypeService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IReleaseTypeService.cs @@ -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 /// Task>> GetListAsync(PageRequest request, bool isAdmin = false); + /// + /// 根据业务数据匹配放舱方式 + /// + /// 业务ID + /// 业务类型 + /// + Task GetReleaseTypeAsync(long businessId, BusinessType businessType); + /// /// 详情 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index e7aa734c..f7442eb3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -47,6 +47,54 @@ public class ClientCommonService : IClientCommonService user = _serviceProvider.GetRequiredService(); saasService = _serviceProvider.GetRequiredService(); } + + /// + /// 根据五字码获取港口信息-客户端 + /// + /// + public async Task> GetClientPortSelectList(string queryKey = "") + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = await tenantDb.Queryable() + .Where(x => x.Status == StatusEnum.Enable && x.EdiCode == queryKey.Trim()) + .Select() + .FirstAsync(); + return await Task.FromResult(DataResult.Success("获取数据成功!", data)); + } + /// + /// 获取航线操作员列表 + /// + /// + public async Task>> GetLaneUserList(string queryKey = "") + { + var data = await db.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsLaner == true) + .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey)) + .Select() + .Take(20) + .WithCache($"{SqlSugarCacheConst.User}{user.TenantId}") + .ToListAsync(); + return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess)); + } + /// + /// 获取委托单位下拉列表 + /// + /// + public async Task>> GetControllerClientList(string queryKey = "") + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = await tenantDb.Queryable() + .InnerJoin((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>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess)); + } /// /// 获取船公司下拉列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ReleaseTypeService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ReleaseTypeService.cs index f4d8a75e..b94f9ab3 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ReleaseTypeService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ReleaseTypeService.cs @@ -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 /// public ReleaseTypeService(IServiceProvider provider) : base(provider) { + TenantDb.QueryFilter.Clear(); } /// @@ -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().Where(whereList) - .WhereIF(!isAdmin, x => x.TenantId == tenantId) + var data = await Db.Queryable() + .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().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; } + /// + /// 根据业务数据匹配放舱方式 + /// + /// 业务ID + /// 业务类型 + /// + public async Task GetReleaseTypeAsync(long businessId, BusinessType businessType) + { + SpaceReleaseType? releaseType = null; + switch (businessType) + { + case BusinessType.OceanShippingExport: + var order1 = await TenantDb.Queryable().Where(x => x.Id == businessId) + .LeftJoin((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().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().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; + } + /// /// 详情 /// @@ -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(); } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BCReadResultDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BCReadResultDto.cs new file mode 100644 index 00000000..dcaedaa5 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BCReadResultDto.cs @@ -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 +{ + /// + /// + /// + public class BCReadResultDto + { + /// + /// 是否成功 true=成功 false=失败 + /// + public bool succ { get; set; } = false; + + /// + /// 状态 0-成功 + /// + public int status { get; set; } = 0; + + /// + /// 返回消息 + /// + public string msg { get; set; } + + /// + /// 总记录数 + /// + public int total { get; set; } + + /// + /// 当前页列表数据 + /// + public object rows { get; set; } + + /// + /// 合计信息 + /// + public object summary { get; set; } + + /// + /// 扩展信息 + /// + public object extra { get; set; } + + /// + /// 扩展信息2 + /// + public object extra2 { get; set; } + + /// + /// 扩展信息场站统计 + /// + public object yardStatInfo { get; set; } + + /// + /// 是否异常 + /// + public bool exceptionflag { get; set; } + + /// + /// 生成HTML + /// + public string ResultHtml { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs index 35475268..772f8626 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs @@ -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 /// Task> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext); + /// + /// 读取BC详情 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + Task> GetReadBC(string carrierCode, IFormFile file); + + /// + /// 读取BC擦写后文件流 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + Task> GetModifyBCFile(string carrierCode, IFormFile file); + /// /// 通过BC任务匹配订单(任务台使用) /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs index bbad1ce8..5a5b0c5e 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -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 bookingSlotService; private Lazy 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 logger, @@ -97,6 +107,11 @@ namespace DS.WMS.Core.TaskPlat.Method tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); tenantDb.QueryFilter.Clear(); + + 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" }); } /// @@ -1121,12 +1136,12 @@ namespace DS.WMS.Core.TaskPlat.Method /// /// 对比BC与海运出口订单(任务台使用) /// - public async Task> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext) + public async Task)>> CompareBcWithSeaExportTask(TaskFlowDataContext dataContext) { var taskBcInfo = dataContext.Get(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}"); var taskBcCtnList = dataContext.Get?>(TaskFlowDataNameConst.TaskBCCtnList) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCCtnList)}"); - var seaExport = await tenantDb.Queryable().Where(x => x.ParentId == 0 && taskBcInfo.MBL_NO == x.MBLNO).Select(x => new SeaExport() + var seaExport = await tenantDb.Queryable().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) result = await CompareBcWithSeaExport(compareDto); - dataContext.Set(TaskFlowDataNameConst.BcCompareWithSeaExportResult, result); + dataContext.Set(TaskFlowDataNameConst.BcCompareBcWithSeaExportIsExistsDiff, result.isExistsDiff); - return DataResult.Success(result); + return DataResult<(bool isExistsDiff, List)>.Success(result); } /// /// 对比BC与海运出口订单 /// - public async Task CompareBcWithSeaExport(CompareBcWithSeaExportDto compareDto) + public async Task<(bool isExistsDiff, List)> 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详情 + /// + /// 读取BC详情 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + public async Task> 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(result); + + if(model != null && model.succ) + { + var bcInfo = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(model.extra)); + + return DataResult.Success(bcInfo); + } + else + { + msg = model.msg; + } + } + } + catch (Exception ex) + { + Logger.Log(NLog.LogLevel.Info, "请求BC读取详情异常,原因:{error}", ex.Message); + + msg = $"请求BC读取详情异常,原因:{ex.Message}"; + + } + + + return DataResult.Failed(msg); + } + } + #endregion + + #region 读取BC擦写后文件流 + /// + /// 读取BC擦写后文件流 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + public async Task> 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.Success(bytes); + } + } + catch (Exception ex) + { + Logger.Log(NLog.LogLevel.Info, "请求自动变更文件内容异常,原因:{error}", ex.Message); + + result = $"请求自动变更文件内容异常,原因:{ex.Message}"; + + } + + } + + return DataResult.Failed(result); + } + #endregion } } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs index e945a7f0..7dcdba93 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs @@ -28,7 +28,42 @@ public class ClientCommonController : ApiController { _invokeService = invokeService; } - + /// + /// 根据五字码获取港口信息-客户端 + /// + /// 港口五字码 + /// + [HttpGet] + [Route("GetClientPortSelectList")] + public async Task> GetClientPortSelectList([FromQuery] string queryKey) + { + var res = await _invokeService.GetClientPortSelectList(queryKey); + return res; + } + /// + /// 获取航线操作员列表-客户端 + /// + /// 用户代码或中文名称 + /// + [HttpGet] + [Route("GetLaneUserList")] + public async Task>> GetLaneUserList([FromQuery] string queryKey) + { + var res = await _invokeService.GetLaneUserList(queryKey); + return res; + } + /// + /// 获取委托单位下拉列表-客户端 + /// + /// 委托单位代码或中文名称 + /// + [HttpGet] + [Route("GetControllerClientList")] + public async Task>> GetControllerClientList([FromQuery] string queryKey) + { + var res = await _invokeService.GetControllerClientList(queryKey); + return res; + } /// /// 获取船公司下拉列表-客户端 /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ReleaseTypeController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ReleaseTypeController.cs index a9b92111..06456293 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ReleaseTypeController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ReleaseTypeController.cs @@ -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; diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs index 01c99e63..8a3159ce 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs @@ -68,5 +68,33 @@ namespace DS.WMS.TaskApi.Controllers return await _taskManageBCService.SyncBookingSlotChange(taskPKId); } #endregion + + #region 读取BC详情 + /// + /// 读取BC详情 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + [HttpPost("GetReadBC")] + public async Task> GetReadBC(string carrierCode, IFormFile file) + { + return await _taskManageBCService.GetReadBC(carrierCode, file); + } + #endregion + + #region 读取BC擦写后文件流 + /// + /// 读取BC擦写后文件流 + /// + /// 船公司代码 + /// BC文件 + /// 返回解析详情 + [HttpPost("GetModifyBCFile")] + public async Task> GetModifyBCFile(string carrierCode, IFormFile file) + { + return await _taskManageBCService.GetModifyBCFile(carrierCode, file); + } + #endregion } } diff --git a/ds-wms-service/DS.WMS.TaskApi/appsettings.json b/ds-wms-service/DS.WMS.TaskApi/appsettings.json index e0abbc7a..48c463f4 100644 --- a/ds-wms-service/DS.WMS.TaskApi/appsettings.json +++ b/ds-wms-service/DS.WMS.TaskApi/appsettings.json @@ -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",