This commit is contained in:
gcw_MV9p2JJN 2026-01-22 17:48:26 +08:00
parent 268bd3a1a6
commit 470d3a7710
4 changed files with 15 additions and 12 deletions

View File

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

View File

@ -615,7 +615,7 @@ public class WorkorderProgressService : BaseService<ProWorkorder>, 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<ProWorkorder>, IWorkorderPro
//3 系列值-这组 今日计划累计完成数每60分钟
//获取今天这个组的所有工单
List<ProWorkorder> ProWorkorderList = Context.Queryable<ProWorkorder>().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<ProWorkorder>, IWorkorderPro
int productOfeachTenMin = allproduct / (allSecends / (60 * 60));
EchartsSeries echartsSeries02 = new EchartsSeries();
echartsSeries02.Name = groupCode + "组今日计划累计完成数每60分钟";
echartsSeries02.Name = groupCode + "组今日计划完成数每60分钟";
echartsSeries02.Type = "bar";
List<EchartsSeriesData> echartsSeriesData02s = new List<EchartsSeriesData>();
//int all_plan_product = 0;

View File

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

View File

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