优化界面卡顿现象,优化PLC读取方式

dev
liulb@mesnac.com 1 year ago
parent 6b05cce2d2
commit fd3edbc046

@ -20,10 +20,6 @@ namespace Admin.Core.Extensions
if (Appsettings.app("Middleware", "Plc", "Enabled").ObjToBool()) if (Appsettings.app("Middleware", "Plc", "Enabled").ObjToBool())
{ {
await plc.StartPlcAsync(); await plc.StartPlcAsync();
//if (result)
// Console.WriteLine("三菱PLC服务启动成功");
//else
// Console.WriteLine("三菱PLC服务启动失败");
} }
} }
catch (Exception e) catch (Exception e)

@ -14,7 +14,10 @@ namespace Aucma.Core.RunPlc
#region 构造函数 #region 构造函数
public RunPlcService() public RunPlcService()
{ {
StartMelsecMcPlcServer();//三菱PLC Task.Run(async () => {
await StartMelsecMcPlcServer();//三菱PLC
});
//StartSiemensPlcServer();//西门子 //StartSiemensPlcServer();//西门子
} }
#endregion #endregion
@ -30,7 +33,7 @@ namespace Aucma.Core.RunPlc
return Task.CompletedTask; return Task.CompletedTask;
} }
private static void StartMelsecMcPlcServer() private static Task StartMelsecMcPlcServer()
{ {
// string ip = Appsettings.app("Middleware", "Scanner1", "Ip"); // string ip = Appsettings.app("Middleware", "Scanner1", "Ip");
var allPlcServices = Appsettings.app<PlcModel>("PLCServer").ToList(); var allPlcServices = Appsettings.app<PlcModel>("PLCServer").ToList();
@ -45,6 +48,7 @@ namespace Aucma.Core.RunPlc
// model.IsConnect = model.plc.IsConnected; // model.IsConnect = model.plc.IsConnected;
PlcHelper.melsecList.Add(model); PlcHelper.melsecList.Add(model);
} }
return Task.CompletedTask;
} }
private static void StartSiemensPlcServer() private static void StartSiemensPlcServer()

@ -92,7 +92,7 @@ namespace Aucma.Core.SheetMetal
// ¿ªÆôQuartzNetJobµ÷¶È·þÎñ // ¿ªÆôQuartzNetJobµ÷¶È·þÎñ
app.UseQuartzJobMildd(tasksQzService, schedulerCenter); app.UseQuartzJobMildd(tasksQzService, schedulerCenter);
//PLC //PLC
app.UsePlcMildd(runPlcService); //app.UsePlcMildd(runPlcService);
} }
#region ×¢²á·þÎñ #region ×¢²á·þÎñ

@ -39,7 +39,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
StationName = "U壳/侧板钣金生产"; StationName = "U壳/侧板钣金生产";
//Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod; Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
Job_SheetMetalTask_Quartz.SmShowDelegateEvent += UpdatePlanSHow;//计划内容展示 Job_SheetMetalTask_Quartz.SmShowDelegateEvent += UpdatePlanSHow;//计划内容展示
WeakReferenceMessenger.Default.Register<string>(this, Recive); WeakReferenceMessenger.Default.Register<string>(this, Recive);
@ -74,7 +74,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// 每日生产 /// 每日生产
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private void InitEveryDayMethod() private Task InitEveryDayMethod()
{ {
ChartValues<double> achievement = new ChartValues<double>(); ChartValues<double> achievement = new ChartValues<double>();
Random random = new Random(); Random random = new Random();
@ -115,6 +115,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
Achievement.Add(column2); Achievement.Add(column2);
//await InitExecMethod(); //await InitExecMethod();
return Task.CompletedTask;
} }

@ -110,8 +110,6 @@
"Enabled": true "Enabled": true
}, },
"Plc": { "Plc": {
"ConString": "127.0.0.1",
"Port": 6000,
"Enabled": true "Enabled": true
} }
}, },

Loading…
Cancel
Save