jianghaiqing 3 months ago
commit a690f76c47

@ -33,7 +33,7 @@ namespace DS.Module.HangfireModule
new BasicAuthAuthorizationUser
{
Login = "admin",
PasswordClear = "admin"
PasswordClear = "ds2024"
}
}
})}

@ -1,4 +1,4 @@
namespace DS.Module.SMS;
namespace DS.Module.HangfireModule;
using DS.Module.Core;
using Hangfire;

@ -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
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
public long OrgId { get; set; }
}
}

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

@ -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;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public OpJobService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
}
}

@ -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
{
//开启事务

@ -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))
else if (item.IsFrontPort && item.isBook == false) {
status = "订阅起运港";
IsBookingYZ = "1";
}
else if (item.isBook && item.IsFrontPort == false)
{
status = "订阅目的港";
IsBookingYZ = "2";
}
else if (!string.IsNullOrWhiteSpace(yardCode) && string.IsNullOrWhiteSpace(carrierCode))
{
status = "订阅起运港";
IsBookingYZ = "1";
}
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<SeaExport>().First(x => x.Id == Convert.ToInt64(item.BusinessId));

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-DS.WMS.JobService-1a1730d9-dd40-4aa2-a301-530bc600777c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.HangfireModule\DS.Module.HangfireModule.csproj" />
<ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" />
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,18 @@
using DS.WMS.JobService;
using DS.Module.HangfireModule;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
//×¢²áÅäÖÃ
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();

@ -0,0 +1,12 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"DS.WMS.JobService": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

@ -0,0 +1,24 @@
namespace DS.WMS.JobService
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
public Worker(ILogger<Worker> 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);
}
}
}
}

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

@ -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"
}
]
}
}

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

Loading…
Cancel
Save