From 50d8905ad6f49385f2f4b6fe5ad359654e2d6f51 Mon Sep 17 00:00:00 2001 From: "liulb@mesnac.com" Date: Mon, 25 Dec 2023 08:43:55 +0800 Subject: [PATCH] new --- Admin.Core.Api/Admin.Core.Model.xml | 5 + .../QuartzNet/Jobs/Job_OldBoxFoam_Quartz.cs | 137 ++++++++++++------ .../ViewModels/FoamMachinesPageViewModel.cs | 2 +- Aucma.Core.OldBoxFoam/Startup.cs | 3 - .../ViewModels/MainWindowViewModel.cs | 6 +- .../ViewModels/OldBoxFoamPageViewModel.cs | 3 +- Aucma.Core.OldBoxFoam/Views/MainWindow.xaml | 4 +- .../Views/OldBoxFoamPageView.xaml | 4 +- 8 files changed, 103 insertions(+), 61 deletions(-) diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 261df9d3..7a3c6968 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -326,6 +326,11 @@ 物料名称 + + + 物料小类 + + 入库方向-A/B diff --git a/Admin.Core.Tasks/QuartzNet/Jobs/Job_OldBoxFoam_Quartz.cs b/Admin.Core.Tasks/QuartzNet/Jobs/Job_OldBoxFoam_Quartz.cs index 36b5ff1c..98eadbf0 100644 --- a/Admin.Core.Tasks/QuartzNet/Jobs/Job_OldBoxFoam_Quartz.cs +++ b/Admin.Core.Tasks/QuartzNet/Jobs/Job_OldBoxFoam_Quartz.cs @@ -56,7 +56,7 @@ namespace Admin.Core.Tasks public async Task Execute(IJobExecutionContext context) { await ExecuteJob(context, async () => await OldBoxFoamDataRun(context));//发泡线 - //await ExecuteJob(context, async () => await OldBoxFoamStoreDataRun(context)); + await ExecuteJob(context, async () => await OldBoxFoamStoreDataRun(context)); } /// /// 发泡线 @@ -415,15 +415,22 @@ namespace Admin.Core.Tasks { item.Fixturestatus = "停止"; } - item.Production = obj.plc.ReadInt16("D181"); item.CuringTimeSettingValue = obj.plc.ReadInt16("D910").ToString(); item.ActualValue = obj.plc.ReadInt16("T3").ToString(); item.UpdatedTime = DateTime.Now; } + var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objProduction == null) { + item.Production = 0; + } + else + { + item.Production = obj.plc.ReadInt16("D181"); + } } if (item.ObjId == 2) { - var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); if (obj == null) { return; } if (obj.plc.IsConnected) { @@ -441,15 +448,23 @@ namespace Admin.Core.Tasks { item.Fixturestatus = "停止"; } - item.Production = obj.plc.ReadInt16("D183"); item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString(); item.ActualValue = obj.plc.ReadInt16("T13").ToString(); item.UpdatedTime = DateTime.Now; } + var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objProduction == null) + { + item.Production = 0; + } + else + { + item.Production = obj.plc.ReadInt16("D183"); + } } if (item.ObjId == 3) { - var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc3")); + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); if (obj == null) { return; } if (obj.plc.IsConnected) { @@ -467,20 +482,34 @@ namespace Admin.Core.Tasks { item.Fixturestatus = "停止"; } - item.Production = obj.plc.ReadInt16("D184"); item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString(); item.ActualValue = obj.plc.ReadInt16("T23").ToString(); item.UpdatedTime = DateTime.Now; } + var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objProduction == null) + { + item.Production = 0; + } + else + { + item.Production = obj.plc.ReadInt16("D184"); + } } if (item.ObjId == 4) { - var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc4")); + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); if (obj == null) { return; } if (obj.plc.IsConnected) { string type = $"{obj.plc.ReadInt16("D3144")}{obj.plc.ReadInt16("D3145")}"; item.Fixtureboxtype = type; + item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString(); + item.ActualValue = obj.plc.ReadInt16("T33").ToString(); + item.UpdatedTime = DateTime.Now; + } + var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objStatus != null) { if (obj.plc.ReadBool("Y100")) { item.Fixturestatus = "手动"; @@ -494,54 +523,66 @@ namespace Admin.Core.Tasks item.Fixturestatus = "停止"; } item.Production = obj.plc.ReadInt16("D185"); - item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString(); - item.ActualValue = obj.plc.ReadInt16("T33").ToString(); - item.UpdatedTime = DateTime.Now; } } if (item.ObjId == 5) { - //var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc5")); - //if (obj == null) { return; } - //if (obj.plc.IsConnected) - //{ - // string type = $"{obj.plc.ReadInt16("D3150")}{obj.plc.ReadInt16("D3151")}"; - // item.Fixtureboxtype = type; - // if (obj.plc.ReadBool("Y105")) - // { - // item.Fixtureboxtype = "手动"; - // } - // if (obj.plc.ReadBool("Y106")) - // { - // item.Fixtureboxtype = "手动"; - // } - // if (obj.plc.ReadBool("Y114")) - // { - // item.Fixtureboxtype = "停止"; - // } - //} + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); + if (obj == null) { return; } + if (obj.plc.IsConnected) + { + string type = $"{obj.plc.ReadInt16("D3150")}{obj.plc.ReadInt16("D3151")}"; + item.Fixtureboxtype = type; + item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString(); + item.ActualValue = obj.plc.ReadInt16("T43").ToString(); + item.UpdatedTime = DateTime.Now; + } + var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objStatus != null) + { + if (obj.plc.ReadBool("Y105")) + { + item.Fixturestatus = "手动"; + } + if (obj.plc.ReadBool("Y106")) + { + item.Fixturestatus = "手动"; + } + if (obj.plc.ReadBool("Y114")) + { + item.Fixturestatus = "停止"; + } + item.Production = obj.plc.ReadInt16("D186"); + } } if (item.ObjId == 6) { - //var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc5")); - //if (obj == null) { return; } - //if (obj.plc.IsConnected) - //{ - // string type = $"{obj.plc.ReadInt16("D3152")}{obj.plc.ReadInt16("D3143")}"; - // item.Fixtureboxtype = type; - // if (obj.plc.ReadBool("Y10A")) - // { - // item.Fixtureboxtype = "手动"; - // } - // if (obj.plc.ReadBool("Y10B")) - // { - // item.Fixtureboxtype = "手动"; - // } - // if (obj.plc.ReadBool("Y115")) - // { - // item.Fixtureboxtype = "停止"; - // } - //} + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); + if (obj == null) { return; } + if (obj.plc.IsConnected) + { + string type = $"{obj.plc.ReadInt16("D3152")}{obj.plc.ReadInt16("D3143")}"; + item.Fixtureboxtype = type; + item.ActualValue = obj.plc.ReadInt16("T53").ToString(); + item.UpdatedTime = DateTime.Now; + } + var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2")); + if (objStatus != null) + { + if (obj.plc.ReadBool("Y10A")) + { + item.Fixturestatus = "手动"; + } + if (obj.plc.ReadBool("Y10B")) + { + item.Fixturestatus = "手动"; + } + if (obj.plc.ReadBool("Y115")) + { + item.Fixturestatus = "停止"; + } + item.Production = obj.plc.ReadInt16("D187"); + } } bool result = await _oldBoxFoamDataServices.UpdateAsync(item); diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs index d4a52429..f44ac2f9 100644 --- a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs @@ -21,7 +21,7 @@ namespace Aucma.Core.BoxFoam.ViewModels public FoamMachinesPageViewModel() { _boxLastShotRecordServices = App.ServiceProvider.GetService(); - Task.WaitAll(LoadData()); + //Task.WaitAll(LoadData()); } #region 加载DataGrid数据 private async Task LoadData() diff --git a/Aucma.Core.OldBoxFoam/Startup.cs b/Aucma.Core.OldBoxFoam/Startup.cs index 27030430..ad7a50d2 100644 --- a/Aucma.Core.OldBoxFoam/Startup.cs +++ b/Aucma.Core.OldBoxFoam/Startup.cs @@ -62,9 +62,6 @@ namespace Aucma.Core.OldBoxFoam //עҵ AddServices(services); - //ɨ - services.AddScannerSetup(); - // services.AddJobSetup(); //PLC diff --git a/Aucma.Core.OldBoxFoam/ViewModels/MainWindowViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/MainWindowViewModel.cs index 5f687a3a..3d4bf6ba 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/MainWindowViewModel.cs @@ -7,7 +7,7 @@ using log4net; using System.Diagnostics; using System.Threading; using Admin.Core.Common; -using Aucma.Core.PLc; +using Aucma.Core.HwPLc; using Aucma.Core.Scanner; using System.Linq; using System.Threading.Tasks; @@ -51,7 +51,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels { RefreshMesDb(); RefreshPlc(); - RefreshScanner(); + //RefreshScanner(); } /// @@ -72,7 +72,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels /// public void RefreshPlc() { - var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("泡前库Plc")); + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1")); if (obj != null) { if (obj.plc.IsConnected) diff --git a/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs index 1e5fd443..a61e688a 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs @@ -29,8 +29,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels Job_OldBoxFoam_Quartz.RefreshOldBoxFoamTypeDataDelegateEvent += OldBoxFoamTypeOnLoad3; Job_OldBoxFoam_Quartz.RefreshOldBoxFoamDataDelegateEvent += OldBoxFoamOnLoad3; - OldBoxFoamOnLoad(); - OldBoxFoamTypeOnLoad(); + Task.WaitAll(OldBoxFoamOnLoad(), OldBoxFoamTypeOnLoad()); } #region 初始化加载数据 diff --git a/Aucma.Core.OldBoxFoam/Views/MainWindow.xaml b/Aucma.Core.OldBoxFoam/Views/MainWindow.xaml index 450aa66e..4b443757 100644 --- a/Aucma.Core.OldBoxFoam/Views/MainWindow.xaml +++ b/Aucma.Core.OldBoxFoam/Views/MainWindow.xaml @@ -79,12 +79,12 @@ - + diff --git a/Aucma.Core.OldBoxFoam/Views/OldBoxFoamPageView.xaml b/Aucma.Core.OldBoxFoam/Views/OldBoxFoamPageView.xaml index 76ff571f..f93485e5 100644 --- a/Aucma.Core.OldBoxFoam/Views/OldBoxFoamPageView.xaml +++ b/Aucma.Core.OldBoxFoam/Views/OldBoxFoamPageView.xaml @@ -95,8 +95,8 @@ - - + +