diff --git a/ds-wms-service/DS.Module.HangfireModule/HangfireMiddleware.cs b/ds-wms-service/DS.Module.HangfireModule/HangfireMiddleware.cs index 06457b41..486ae5b9 100644 --- a/ds-wms-service/DS.Module.HangfireModule/HangfireMiddleware.cs +++ b/ds-wms-service/DS.Module.HangfireModule/HangfireMiddleware.cs @@ -33,7 +33,7 @@ namespace DS.Module.HangfireModule new BasicAuthAuthorizationUser { Login = "admin", - PasswordClear = "admin" + PasswordClear = "ds2024" } } })} diff --git a/ds-wms-service/DS.Module.HangfireModule/HangfireModuleInstall.cs b/ds-wms-service/DS.Module.HangfireModule/HangfireModuleInstall.cs index e44cf9a6..18a6613c 100644 --- a/ds-wms-service/DS.Module.HangfireModule/HangfireModuleInstall.cs +++ b/ds-wms-service/DS.Module.HangfireModule/HangfireModuleInstall.cs @@ -1,4 +1,4 @@ -namespace DS.Module.SMS; +namespace DS.Module.HangfireModule; using DS.Module.Core; using Hangfire; diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/BaseJobReq.cs b/ds-wms-service/DS.WMS.Core/HangfireJob/BaseJobReq.cs new file mode 100644 index 00000000..12e6892d --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/HangfireJob/BaseJobReq.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.HangfireJob +{ + public class BaseJobReq + { + /// + /// 主键Id + /// + public long Id { get; set; } + + + /// + /// 用户Id + /// + public long UserId { get; set; } + /// + /// 租户Id + /// + public long TenantId { get; set; } + /// + /// 机构Id + /// + public long OrgId { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IOpJobService.cs b/ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IOpJobService.cs new file mode 100644 index 00000000..51b3fb32 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IOpJobService.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Threading.Tasks; +using Hangfire; + +namespace DS.WMS.Core.HangfireJob.Interface +{ + public interface IOpJobService + { + //[Queue("op")] + //void GetVgmLink(); + } +} diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs new file mode 100644 index 00000000..56399320 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs @@ -0,0 +1,34 @@ +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.HangfireJob.Interface; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; + +namespace DS.WMS.Core.HangfireJob.Method +{ + public class OpJobService: IOpJobService + { + + + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + private readonly ISaasDbService saasService; + /// + /// + /// + /// + public OpJobService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 7e8cc4a3..d49bb216 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -15,6 +15,7 @@ using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; +using DS.WMS.Core.TaskPlat.Dtos; using LanguageExt; using Mapster; using Microsoft.AspNetCore.Hosting; @@ -225,7 +226,16 @@ public partial class SeaExportService : ISeaExportService data.StlDate = stlInfo.Data.StlDate; data.AccountDate = stlInfo.Data.AccountDate; #endregion - + //判断是否订阅运踪目的港起运港标识 + if (!string.IsNullOrEmpty(data.MBLNO)) + { + data.IsBookingYZ = "1"; + + } + else + { + data.IsBookingYZ = "0"; + } try { //开启事务 @@ -325,6 +335,17 @@ public partial class SeaExportService : ISeaExportService info.StlDate = stlInfo.Data.StlDate; info.AccountDate = stlInfo.Data.AccountDate; #endregion + + //判断是否订阅运踪目的港起运港标识 + if (!string.IsNullOrEmpty(info.MBLNO)) + { + info.IsBookingYZ = "1"; + + } + else + { + info.IsBookingYZ = "0"; + } try { //开启事务 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs index 4aa19048..714a457e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs @@ -111,29 +111,50 @@ namespace DS.WMS.Core.Op.Method YardCode = yardMap.MapCode == "" ? null : yardMap.MapCode, CARRIER = carrierName, CARRIERID = carrierCode == "" ? null : carrierCode, - isBook = item.isBook + isBook = item.isBook, + IsFrontPort = item.IsFrontPort, }); var status = string.Empty; var IsBookingYZ = String.Empty; - if (!string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode)) + + if (item.IsFrontPort && item.isBook) { status = "订阅起运港,目的港"; IsBookingYZ = "3"; } - else if (string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode)) - { - status = "订阅目的港"; - IsBookingYZ = "2"; + else if (item.IsFrontPort && item.isBook == false) { + + status = "订阅起运港"; + IsBookingYZ = "1"; } - else if (!string.IsNullOrWhiteSpace(yardCode) && string.IsNullOrWhiteSpace(carrierCode)) + else if (item.isBook && item.IsFrontPort == false) { - status = "订阅起运港"; - IsBookingYZ = "1"; + status = "订阅目的港"; + IsBookingYZ = "2"; } - else + else { IsBookingYZ = "0"; } + //if (!string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode)) + //{ + // status = "订阅起运港,目的港"; + // IsBookingYZ = "3"; + //} + //else if (string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode)) + //{ + // status = "订阅目的港"; + // IsBookingYZ = "2"; + //} + //else if (!string.IsNullOrWhiteSpace(yardCode) && string.IsNullOrWhiteSpace(carrierCode)) + //{ + // status = "订阅起运港"; + // IsBookingYZ = "1"; + //} + //else + //{ + // IsBookingYZ = "0"; + //} //TODO 添加booking日志 //更新运踪标识 var info = tenantDb.Queryable().First(x => x.Id == Convert.ToInt64(item.BusinessId)); diff --git a/ds-wms-service/DS.WMS.JobService/DS.WMS.JobService.csproj b/ds-wms-service/DS.WMS.JobService/DS.WMS.JobService.csproj new file mode 100644 index 00000000..64af6281 --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/DS.WMS.JobService.csproj @@ -0,0 +1,20 @@ + + + + net8.0 + enable + enable + dotnet-DS.WMS.JobService-1a1730d9-dd40-4aa2-a301-530bc600777c + + + + + + + + + + + + + diff --git a/ds-wms-service/DS.WMS.JobService/Program.cs b/ds-wms-service/DS.WMS.JobService/Program.cs new file mode 100644 index 00000000..fa57238d --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/Program.cs @@ -0,0 +1,18 @@ +using DS.WMS.JobService; +using DS.Module.HangfireModule; + +var builder = Host.CreateApplicationBuilder(args); +builder.Services.AddHostedService(); +//ע +builder.Configuration + // .SetBasePath(builder.Environment.ContentRootPath) + .AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true) + // .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true) + .Build(); +builder.Configuration.AddEnvironmentVariables(); +//עhangfire +builder.Services.AddHangfireModuleInstall(); + + +var host = builder.Build(); +host.Run(); diff --git a/ds-wms-service/DS.WMS.JobService/Properties/launchSettings.json b/ds-wms-service/DS.WMS.JobService/Properties/launchSettings.json new file mode 100644 index 00000000..4d5d5826 --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "DS.WMS.JobService": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/ds-wms-service/DS.WMS.JobService/Worker.cs b/ds-wms-service/DS.WMS.JobService/Worker.cs new file mode 100644 index 00000000..e002a0b5 --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/Worker.cs @@ -0,0 +1,24 @@ +namespace DS.WMS.JobService +{ + public class Worker : BackgroundService + { + private readonly ILogger _logger; + + public Worker(ILogger logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + if (_logger.IsEnabled(LogLevel.Information)) + { + _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + } + await Task.Delay(1000, stoppingToken); + } + } + } +} diff --git a/ds-wms-service/DS.WMS.JobService/appsettings.Development.json b/ds-wms-service/DS.WMS.JobService/appsettings.Development.json new file mode 100644 index 00000000..b2dcdb67 --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/ds-wms-service/DS.WMS.JobService/appsettings.json b/ds-wms-service/DS.WMS.JobService/appsettings.json new file mode 100644 index 00000000..3050e778 --- /dev/null +++ b/ds-wms-service/DS.WMS.JobService/appsettings.json @@ -0,0 +1,23 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "DBInfo": { + "DefaultDbConnId": "1288018625843826688", + "DefaultDbType": 0, + "DefaultDbString": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_dev", + "HangfireDbString": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_hangfire", + "DBS": [ + { + "ConnId": "1288018625843826680", + "DBType": 0, + "Enabled": false, + "HitRate": 40, + "Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_log" + } + ] + } +} diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 589be2a0..4cd6de91 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -72,7 +72,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.OcrModule", "DS.M EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.ContainerManagementApi", "DS.WMS.ContainerManagementApi\DS.WMS.ContainerManagementApi.csproj", "{7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.HangfireModule", "DS.Module.HangfireModule\DS.Module.HangfireModule.csproj", "{BDF89987-3B7B-4CC6-88A9-DA4765F6FF62}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.HangfireModule", "DS.Module.HangfireModule\DS.Module.HangfireModule.csproj", "{BDF89987-3B7B-4CC6-88A9-DA4765F6FF62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.JobService", "DS.WMS.JobService\DS.WMS.JobService.csproj", "{99B79A25-3732-4023-BD56-ABD169CE43AD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -204,6 +206,10 @@ Global {BDF89987-3B7B-4CC6-88A9-DA4765F6FF62}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDF89987-3B7B-4CC6-88A9-DA4765F6FF62}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDF89987-3B7B-4CC6-88A9-DA4765F6FF62}.Release|Any CPU.Build.0 = Release|Any CPU + {99B79A25-3732-4023-BD56-ABD169CE43AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99B79A25-3732-4023-BD56-ABD169CE43AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99B79A25-3732-4023-BD56-ABD169CE43AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99B79A25-3732-4023-BD56-ABD169CE43AD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -240,6 +246,7 @@ Global {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {BDF89987-3B7B-4CC6-88A9-DA4765F6FF62} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} + {99B79A25-3732-4023-BD56-ABD169CE43AD} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}