From ed645082617b60a4cb4dd1c863957ae1a7135b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZR20090193-=E9=99=88=E6=95=AC=E5=8B=87?= Date: Mon, 22 May 2023 14:26:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=B7=E5=BA=B7=E7=AE=B1?= =?UTF-8?q?=E5=8F=B7=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gslk-wmsapi-service-server/Api.xml | 7 ++ .../OpenApiModule/Dtos/HkRecords.cs | 102 ++++++++++++++++++ .../OpenApiModule/Entity/tb_TruckRecord.cs | 5 +- .../OpenApiModule/Method/PortOpenService.cs | 35 +++++- .../DS.WMS.WebApi/DS.WMS.WebApi.csproj | 1 + .../DS.WMS.WebApi/Program.cs | 40 +++---- 6 files changed, 167 insertions(+), 23 deletions(-) create mode 100644 gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Dtos/HkRecords.cs diff --git a/gslk-wmsapi-service-server/Api.xml b/gslk-wmsapi-service-server/Api.xml index d5d1e27..64b5fe5 100644 --- a/gslk-wmsapi-service-server/Api.xml +++ b/gslk-wmsapi-service-server/Api.xml @@ -568,6 +568,13 @@ + + + 内部车辆取消包期 + + + + 公告模块 diff --git a/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Dtos/HkRecords.cs b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Dtos/HkRecords.cs new file mode 100644 index 0000000..700b3b7 --- /dev/null +++ b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Dtos/HkRecords.cs @@ -0,0 +1,102 @@ +namespace DS.WMS.Core.OpenApiModule.Dtos; + +public class HkRecords +{ + /// + /// + /// + public int Total { get; set; } + /// + /// + /// + public int PageSize { get; set; } + /// + /// + /// + public int PageNo { get; set; } + /// + /// + /// + public int TotalPages { get; set; } + /// + /// + /// + public List List { get; set; } +} + + +public class RecordList +{ + /// + /// 闸口事件id + /// + public int Id { get; set; } + /// + /// 设备名称 + /// + public string DeviceName { get; set; } + /// + /// 设备id + /// + public string DeviceId { get; set; } + /// + /// 到达时间 + /// + public DateTime StartTime { get; set; } + /// + /// 离开时间 + /// + public DateTime EndTime { get; set; } + /// + /// 集装箱型号 + /// + public int Model { get; set; } + /// + /// 集装箱模式 + /// + public string Mode { get; set; } + /// + /// 集装箱1号 + /// + public string ContainerNumOne { get; set; } + /// + /// 集装箱1号ISO + /// + public string ContainerISONumOne { get; set; } + /// + /// 集装箱1号ISO + /// + public string ContainerNumTwo { get; set; } + /// + /// 集装箱2号 + /// + public string ContainerISONumTwo { get; set; } + /// + /// 车牌号 + /// + public string PlateNo { get; set; } + /// + /// 车牌颜色 + /// + public string PlateColor { get; set; } + /// + /// 车身颜色 + /// + public string VehicleColor { get; set; } + /// + /// 集装箱图片urls + /// + public List ContainerPicUrls { get; set; } + /// + /// 车牌图url + /// + public string PlatePicUrl { get; set; } + /// + /// 车辆图url + /// + public string VehiclePicUrl { get; set; } + /// + /// 记录类型 + /// + public int RecordType { get; set; } +} \ No newline at end of file diff --git a/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Entity/tb_TruckRecord.cs b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Entity/tb_TruckRecord.cs index 23fa644..ba656c4 100644 --- a/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Entity/tb_TruckRecord.cs +++ b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Entity/tb_TruckRecord.cs @@ -33,7 +33,10 @@ public partial class tb_TruckRecord /// Nullable:False /// public string TRUCKNO { get; set; } - + /// + /// 箱号 + /// + public string BoxNo { get; set; } /// /// /// diff --git a/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Method/PortOpenService.cs b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Method/PortOpenService.cs index 366a554..77eb960 100644 --- a/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Method/PortOpenService.cs +++ b/gslk-wmsapi-service-server/DS.WMS.Core/OpenApiModule/Method/PortOpenService.cs @@ -1,10 +1,12 @@ using DS.Module.Core; using DS.Module.Core.Extensions; +using DS.Module.HkOpenApi; using DS.WMS.Core.OpenApiModule.Dtos; using DS.WMS.Core.OpenApiModule.Entity; using DS.WMS.Core.OpenApiModule.Interface; using Mapster; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; using NLog; using SqlSugar; @@ -15,7 +17,7 @@ public class PortOpenService : IPortOpenService private readonly IServiceProvider _serviceProvider; private readonly ISqlSugarClient db; static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - + private readonly IHttpRequestService _ihkHttpService; /// /// /// @@ -24,6 +26,7 @@ public class PortOpenService : IPortOpenService { _serviceProvider = serviceProvider; db = _serviceProvider.GetRequiredService(); + _ihkHttpService = _serviceProvider.GetRequiredService(); } @@ -76,8 +79,36 @@ public class PortOpenService : IPortOpenService { return DataResult.Failed("车辆信息不存在!"); } - var info = model.Adapt(); + var now = DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss"); + var end = DateTime.Now.AddMinutes(5).ToString("yyyy-MM-dd HH:mm:ss"); + var parm = new + { + boxNo = "", + plateNo = info.TRUCKNO, + pageNo = 1, + pageSize = 20, + startTime = now, + endTime = end, + }; + var req = new HKPostData() + { + Url = "/artemis/api/pms/v1/record/query/gate", + Data = JsonConvert.SerializeObject(parm), + }; + var res= _ihkHttpService.HKHttpPost(req); + if (res.Code == "0") + { + Logger.Log(LogLevel.Info, + DateTime.Now.ToString() + JsonConvert.SerializeObject(res.Data)); + var record = JsonConvert.DeserializeObject(res.Data.ToString()); + info.BoxNo = record.List[0].ContainerNumOne +";"+ record.List[0].ContainerNumTwo; + } + else + { + Logger.Log(LogLevel.Error, + DateTime.Now.ToString() + JsonConvert.SerializeObject(res)); + } await db.Insertable(info).ExecuteCommandAsync(); diff --git a/gslk-wmsapi-service-server/DS.WMS.WebApi/DS.WMS.WebApi.csproj b/gslk-wmsapi-service-server/DS.WMS.WebApi/DS.WMS.WebApi.csproj index 876274e..9a627c8 100644 --- a/gslk-wmsapi-service-server/DS.WMS.WebApi/DS.WMS.WebApi.csproj +++ b/gslk-wmsapi-service-server/DS.WMS.WebApi/DS.WMS.WebApi.csproj @@ -40,6 +40,7 @@ + diff --git a/gslk-wmsapi-service-server/DS.WMS.WebApi/Program.cs b/gslk-wmsapi-service-server/DS.WMS.WebApi/Program.cs index bbc696f..d6a038d 100644 --- a/gslk-wmsapi-service-server/DS.WMS.WebApi/Program.cs +++ b/gslk-wmsapi-service-server/DS.WMS.WebApi/Program.cs @@ -41,8 +41,8 @@ builder.Services.AddSmsModuleInstall();//短信服务 builder.Services.AddHKModuleInstall();//海康服务 builder.Services.AddJwtInstall(); -builder.Services.AddHangfireInstall();//Hangfire -builder.Services.AddModbusInstall();//Modbus服务 +// builder.Services.AddHangfireInstall();//Hangfire +// builder.Services.AddModbusInstall();//Modbus服务 // 3、配置中间件 var app = builder.Build(); // if (app.Environment.IsDevelopment()) @@ -72,24 +72,24 @@ if (!policyName.IsNullOrEmpty()) { app.UseCors(policyName); //添加跨域中间件 } -app.UseHangfireServer(); -app.UseHangfireDashboard("/hangfire", new DashboardOptions -{ - Authorization = new[] {new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions - { - RequireSsl = false, - SslRedirect = false, - LoginCaseSensitive = true, - Users = new [] - { - new BasicAuthAuthorizationUser - { - Login = "admin", - PasswordClear = "admin" - } - } - })} -}); +// app.UseHangfireServer(); +// app.UseHangfireDashboard("/hangfire", new DashboardOptions +// { +// Authorization = new[] {new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions +// { +// RequireSsl = false, +// SslRedirect = false, +// LoginCaseSensitive = true, +// Users = new [] +// { +// new BasicAuthAuthorizationUser +// { +// Login = "admin", +// PasswordClear = "admin" +// } +// } +// })} +// }); app.UseRouting(); app.UseStaticFiles();