diff --git a/DOAN.Admin.WebApi/Controllers/MES/andon/AndonInteractionController.cs b/DOAN.Admin.WebApi/Controllers/MES/andon/AndonInteractionController.cs index 1455dfa..ad1ba44 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/andon/AndonInteractionController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/andon/AndonInteractionController.cs @@ -87,7 +87,7 @@ namespace DOAN.WebApi.Controllers.MES.andon [HttpPost("signin")] public IActionResult SignIn([FromBody] AndonResponseQueryDto response) { - if (response == null) + if (response == null||response.Id==null) { return SUCCESS(null); diff --git a/DOAN.Service/JobKanban/WorkorderProgressService.cs b/DOAN.Service/JobKanban/WorkorderProgressService.cs index 1df05ec..37782a2 100644 --- a/DOAN.Service/JobKanban/WorkorderProgressService.cs +++ b/DOAN.Service/JobKanban/WorkorderProgressService.cs @@ -615,7 +615,7 @@ public class WorkorderProgressService : BaseService, IWorkorderPro DateTime[] dateTimeArray = new DateTime[intervals]; for (int i = 0; i < intervals; i++) { - TimeSpan spanItem = new TimeSpan(0, 10 * i, 0);// 60分钟间隔 + TimeSpan spanItem = new TimeSpan(0, 60 * i, 0);// 60分钟间隔 DateTime TodayItem = todayAtEight + spanItem; dateTimeArray[i] = TodayItem; } @@ -699,7 +699,10 @@ public class WorkorderProgressService : BaseService, IWorkorderPro //3 系列值-这组 今日计划累计完成数(每60分钟) //获取今天这个组的所有工单 List ProWorkorderList = Context.Queryable().Where(it => it.GroupCode == groupCode && it.WorkorderDate == DateTime.Today).ToList(); - + if (ProWorkorderList.Count() == 0) + { + return null; + } //求出总产量需要多少s int allSecends = 0; foreach (var item in ProWorkorderList) @@ -713,7 +716,7 @@ public class WorkorderProgressService : BaseService, IWorkorderPro int productOfeachTenMin = allproduct / (allSecends / (60 * 60)); EchartsSeries echartsSeries02 = new EchartsSeries(); - echartsSeries02.Name = groupCode + "组今日计划累计完成数(每60分钟)"; + echartsSeries02.Name = groupCode + "组今日计划完成数(每60分钟)"; echartsSeries02.Type = "bar"; List echartsSeriesData02s = new List(); //int all_plan_product = 0; diff --git a/DOAN.Service/MES/andon/AndonInteractionService.cs b/DOAN.Service/MES/andon/AndonInteractionService.cs index 4d96425..fc0be9d 100644 --- a/DOAN.Service/MES/andon/AndonInteractionService.cs +++ b/DOAN.Service/MES/andon/AndonInteractionService.cs @@ -194,7 +194,7 @@ namespace DOAN.Service.MES.andon record.EndTime = DateTime.Now; - TimeSpan timeDifference = record.EndTime.Value - record.StartTime.Value; + TimeSpan timeDifference = (record.EndTime ?? DateTime.MinValue) - (record.StartTime ?? DateTime.MinValue); record.Duration = Math.Round((decimal)timeDifference.TotalMinutes, 2); record.Status = 2; diff --git a/Infrastructure/Helper/MqttHelper.cs b/Infrastructure/Helper/MqttHelper.cs index 063634f..f824cac 100644 --- a/Infrastructure/Helper/MqttHelper.cs +++ b/Infrastructure/Helper/MqttHelper.cs @@ -62,12 +62,12 @@ namespace DOAN.Infrastructure.Helper Console.WriteLine($"正在连接到 MQTT Broker: {MqttBrokerUrl}:{MqttBrokerPort}..."); await _mqttClient.ConnectAsync(options); - Console.WriteLine("✅ MQTT 连接成功!"); + Console.WriteLine(" MQTT 连接成功!"); return true; } catch (Exception ex) { - Console.WriteLine($"❌ MQTT 连接失败: {ex.Message}"); + Console.WriteLine($" MQTT 连接失败: {ex.Message}"); return false; } } @@ -90,7 +90,7 @@ namespace DOAN.Infrastructure.Helper Console.WriteLine("MQTT 客户端未连接,尝试重新连接..."); if (!await ConnectAsync()) { - Console.WriteLine("❌ 重连失败,无法发送消息"); + Console.WriteLine(" 重连失败,无法发送消息"); return false; } } @@ -105,12 +105,12 @@ namespace DOAN.Infrastructure.Helper Console.WriteLine($"正在向主题 '{topic}' 发送消息: {messageContent}"); await _mqttClient.PublishAsync(message); - Console.WriteLine("✅ 消息发送成功!"); + Console.WriteLine(" 消息发送成功!"); return true; } catch (Exception ex) { - Console.WriteLine($"❌ 消息发送失败: {ex.Message}"); + Console.WriteLine($" 消息发送失败: {ex.Message}"); return false; } } @@ -138,12 +138,12 @@ namespace DOAN.Infrastructure.Helper if (_mqttClient?.IsConnected == true) { await _mqttClient.DisconnectAsync(); - Console.WriteLine("🔌 MQTT 已断开连接"); + Console.WriteLine(" MQTT 已断开连接"); } } catch (Exception ex) { - Console.WriteLine($"❌ 断开连接时发生错误: {ex.Message}"); + Console.WriteLine($" 断开连接时发生错误: {ex.Message}"); } }