From 71403ae64ef53b2295308b722f1b4a0f9142c8de Mon Sep 17 00:00:00 2001 From: Hinse <756681202@qq.com> Date: Tue, 17 May 2022 18:07:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=AE=B0=E5=BD=95bug?= =?UTF-8?q?=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResultInfos/ResultService.cs | 3 +- Waste.SocketService.cs/MyPackageFilter.cs | 17 ++++++++++ Waste.SocketService.cs/Program.cs | 4 +-- .../PublishProfiles/FolderProfile.pubxml.user | 2 +- Waste.Web.Core/Startup.cs | 31 ++++++++++--------- Waste.Web.Entry/Pages/Login/Index.cshtml | 8 ++--- Waste.Web.Entry/Pages/Login/Index.cshtml.cs | 19 ++++++++++++ .../waste.ybhdmob.com.pubxml.user | 2 +- Waste.Web.Entry/Startup.cs | 7 ----- 9 files changed, 63 insertions(+), 30 deletions(-) diff --git a/Waste.Application/ResultInfos/ResultService.cs b/Waste.Application/ResultInfos/ResultService.cs index 7269b11..e02edd7 100644 --- a/Waste.Application/ResultInfos/ResultService.cs +++ b/Waste.Application/ResultInfos/ResultService.cs @@ -232,6 +232,7 @@ namespace Waste.Application { isfrist = true; } + var Weight = myPackage.Weight.IsEmpty() ? 0 : myPackage.Weight.ToDecimal(); //记录数据 await dbClient.Ado.UseStoredProcedure().ExecuteCommandAsync("Proc_InsertResult", new { @@ -248,7 +249,7 @@ namespace Waste.Application city = "", area = myPackage.trashcode, wastetype = myPackage.WasteType, - weigth = myPackage.Weight, + weigth = Weight, isheart = myPackage.IsHeart, tare = device.Tare, isfrist = isfrist diff --git a/Waste.SocketService.cs/MyPackageFilter.cs b/Waste.SocketService.cs/MyPackageFilter.cs index 212b3d1..14ec14c 100644 --- a/Waste.SocketService.cs/MyPackageFilter.cs +++ b/Waste.SocketService.cs/MyPackageFilter.cs @@ -251,6 +251,23 @@ namespace Waste.SocketService package.Latitude = gpsarr[1]; } } + else if(arr.Length == 7 && string.IsNullOrEmpty(arr[6])) + { + package.IsHeart = true; + package.ICCID = arr[0]; + package.IMEI = arr[1]; + package.IMSI = arr[2]; + var gslq = Encoding.GetEncoding("GB2312").GetBytes(arr[3]); + if (gslq.Length == 2) + { + package.GSLQ = Convert.ToInt32(gslq[1]).ToString(); + } + else + { + package.GSLQ = gslq.BytesToHexStr(); + } + package.Time = $"{arr[4]}{arr[5]}".Replace("-", "").Replace(":", ""); + } else if (arr.Length == 7) { package.ICCID = arr[0]; diff --git a/Waste.SocketService.cs/Program.cs b/Waste.SocketService.cs/Program.cs index eed9bec..ed37b17 100644 --- a/Waste.SocketService.cs/Program.cs +++ b/Waste.SocketService.cs/Program.cs @@ -115,11 +115,11 @@ namespace Waste.SocketService string msg = $"ͨУ,ʮ:{package.Body},ַ:{package.Str}"; if (package.IsHeart) { - msg = $"{msg},,IMEI:{package.IMEI},:{package.Longitude},γ:{package.Latitude}"; + msg = $"{msg},,{(package == null?"":JsonConvert.SerializeObject(package))}"; } else { - msg = $"{msg},,ICCID:{package.ICCID},IMEI:{package.IMEI},IMSI:{package.IMSI},ź:{package.GSLQ}"; + msg = $"{msg},,{(package == null ? "" : JsonConvert.SerializeObject(package))}"; if (package.IsWeight) { msg = $"{msg},ͰС:{package.size},Ͱ:{package.trashcode},:{package.WasteType},:{package.Weight}KG"; diff --git a/Waste.SocketService.cs/Properties/PublishProfiles/FolderProfile.pubxml.user b/Waste.SocketService.cs/Properties/PublishProfiles/FolderProfile.pubxml.user index cf83514..e8b8e97 100644 --- a/Waste.SocketService.cs/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Waste.SocketService.cs/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2021-11-23T09:56:50.1140092Z;True|2021-11-23T17:47:15.3723334+08:00;True|2021-11-23T17:46:56.0953346+08:00;True|2021-11-23T15:39:30.7279293+08:00;True|2021-11-23T15:26:11.9749528+08:00;True|2021-11-23T15:19:15.3506970+08:00;True|2021-11-23T14:58:10.0460847+08:00; + True|2022-05-17T09:19:03.8993888Z;True|2021-11-23T17:56:50.1140092+08:00;True|2021-11-23T17:47:15.3723334+08:00;True|2021-11-23T17:46:56.0953346+08:00;True|2021-11-23T15:39:30.7279293+08:00;True|2021-11-23T15:26:11.9749528+08:00;True|2021-11-23T15:19:15.3506970+08:00;True|2021-11-23T14:58:10.0460847+08:00; \ No newline at end of file diff --git a/Waste.Web.Core/Startup.cs b/Waste.Web.Core/Startup.cs index 7c3ea19..477019e 100644 --- a/Waste.Web.Core/Startup.cs +++ b/Waste.Web.Core/Startup.cs @@ -32,23 +32,26 @@ namespace Waste.Web.Core services.AddHttpClient(); //添加CAP - services.AddCap(x => + string port = configuration["RabbitmqSetting:Port"]; + int p = Convert.ToInt32(port); + if (p > 0) { - x.DefaultGroupName = "jtsky.queue.waste"; //rabbitmq的队列名称 - //配置rabbitmq支持 - string port = configuration["RabbitmqSetting:Port"]; - int p = Convert.ToInt32(port); - x.UseRabbitMQ(opt => + services.AddCap(x => { - opt.HostName = configuration["RabbitmqSetting:HostName"]; //配置ip地址 - opt.Port = p;//配置端口 - opt.UserName = configuration["RabbitmqSetting:UserName"];//配置用户名 - opt.Password = configuration["RabbitmqSetting:Password"];//配置Miami + x.DefaultGroupName = "jtsky.queue.waste"; //rabbitmq的队列名称 + //配置rabbitmq支持 + x.UseRabbitMQ(opt => + { + opt.HostName = configuration["RabbitmqSetting:HostName"]; //配置ip地址 + opt.Port = p;//配置端口 + opt.UserName = configuration["RabbitmqSetting:UserName"];//配置用户名 + opt.Password = configuration["RabbitmqSetting:Password"];//配置Miami + }); + //配置sqlserver支持 + x.UseSqlServer(configuration["RabbitmqSetting:DBConnection"]); }); - //配置sqlserver支持 - x.UseSqlServer(configuration["RabbitmqSetting:DBConnection"]); - }); + } services.AddControllers(options => { options.EnableEndpointRouting = true; @@ -100,7 +103,7 @@ namespace Waste.Web.Core context.Request.EnableBuffering(); return next(context); }); - // app.UseHttpsRedirection(); + // app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSerilogRequestLogging(opts => diff --git a/Waste.Web.Entry/Pages/Login/Index.cshtml b/Waste.Web.Entry/Pages/Login/Index.cshtml index 38a3539..1cc9d50 100644 --- a/Waste.Web.Entry/Pages/Login/Index.cshtml +++ b/Waste.Web.Entry/Pages/Login/Index.cshtml @@ -28,10 +28,10 @@
- +
-

@Furion.App.Configuration["CustomSetting:SoftName"]

-

@Furion.App.Configuration["CustomSetting:SoftDesc"]

+

@Model.SoftName

+

@Model.SoftDesc

@@ -63,7 +63,7 @@