From e32041e33a8bdc1dd3ddbfcdf7756a8399b38f64 Mon Sep 17 00:00:00 2001 From: liuwf Date: Thu, 28 Dec 2023 14:27:44 +0800 Subject: [PATCH] change. --- .../Model_New/BoxLastShotRecord.cs | 168 ++++++++---------- .../Jobs/Job_BoxFoamLastData_Quartz.cs | 63 ++++--- .../Business/InStoreBusiness.cs | 4 +- .../ViewModels/FoamMachinesPageViewModel.cs | 42 ++--- Aucma.Core.ProductOffLine/appsettings.json | 4 +- 5 files changed, 135 insertions(+), 146 deletions(-) diff --git a/Admin.Core.Model/Model_New/BoxLastShotRecord.cs b/Admin.Core.Model/Model_New/BoxLastShotRecord.cs index 332d73fc..23c94423 100644 --- a/Admin.Core.Model/Model_New/BoxLastShotRecord.cs +++ b/Admin.Core.Model/Model_New/BoxLastShotRecord.cs @@ -13,157 +13,147 @@ namespace Admin.Core.Model /// [SugarTable("BOX_LASTSHOTRECORD", "AUCMA_SCADA")] public class BoxLastShotRecord - { + { /// /// 主键 /// [SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true)] public int ObjId { get; set; } - /// - /// 夹具类型 - /// - [SugarColumn(ColumnName = "BOXFIXTURETYPE")] - public string BoxFixtureType { get; set; } - /// /// 所属系统;1系统 2系统 /// [SugarColumn(ColumnName = "SYSTEM")] public string System { get; set; } + /// - /// 枪头 + /// 枪编号;A1枪,B1枪,A2枪,B2枪 /// - [SugarColumn(ColumnName = "GUNHEAD")] - public string GunHead { get; set; } + [SugarColumn(ColumnName = "GUN_CODE")] + public string GunCode { get; set; } /// - /// 工位号 + /// 产线编号 /// - [SugarColumn(ColumnName = "STATIONNUMBER")] - public string StationNumber { get; set; } + [SugarColumn(ColumnName = "PRODUCT_LINE_CODE")] + public string ProductLineCode { get; set; } /// - /// POL注料压力 + /// 枪POL注料温度 /// - [SugarColumn(ColumnName = "POL_INJECTIONPRESSURE")] - public string PolInjectionpressure { get; set; } - + [SugarColumn(ColumnName = "POL_TEMP")] + public string PolTemp { get; set; } /// - /// ISO注料压力 + /// 枪POL注料压力 /// - [SugarColumn(ColumnName = "ISO_INJECTIONPRESSURE")] - public string IsoInjectionpressure { get; set; } + [SugarColumn(ColumnName = "POL_HP")] + public string PolHp { get; set; } /// - /// POL注料温度 + /// 枪POL注料流量 /// - [SugarColumn(ColumnName = "POL_INJECTIONTEMPERATURE")] - public string PolInjectiontemperature { get; set; } + [SugarColumn(ColumnName = "POL_VOL")] + public string PolVol { get; set; } /// - /// ISO注料温度 + /// 枪POL原料用量 /// - [SugarColumn(ColumnName = "ISO_INJECTIONTEMPERATURE")] - public string IsoInjectiontemperature { get; set; } + [SugarColumn(ColumnName = "POL_USAGE")] + public string PolUsage { get; set; } + /// - /// 中压循环时间 + /// 枪ISO注料温度 /// - [SugarColumn(ColumnName = "MEDIUMPRESSURECYCLETIME")] - public string MediumPressureCycleTime { get; set; } + [SugarColumn(ColumnName = "ISO_TEMP")] + public string IsoTemp { get; set; } /// - /// 高压循环时间 + /// 枪ISO注料压力 /// - [SugarColumn(ColumnName = "HIGHPRESSURECYCLETIME")] - public string HighPressureCycleTime { get; set; } + [SugarColumn(ColumnName = "ISO_HP")] + public string IsoHp { get; set; } /// - /// 设定注料重量 + ///枪ISO注料流量 /// - [SugarColumn(ColumnName = "SETINJECTIONWEIGHT")] - public string SetInjectionWeight { get; set; } + [SugarColumn(ColumnName = "ISO_VOL")] + public string IsoVol { get; set; } /// - /// 设定注料料比 + /// 枪ISO原料用量 /// - [SugarColumn(ColumnName = "INJECTIONMATERIALRATIO")] - public string InjectionMaterialRatio { get; set; } + [SugarColumn(ColumnName = "ISO_USAGE")] + public string IsoUsage { get; set; } /// - /// 实际注料重量 + /// 枪注料工位号 /// - [SugarColumn(ColumnName = "ACTUALINJECTIONWEIGHT")] - public string ActualInjectionWeight { get; set; } + [SugarColumn(ColumnName = "POUR_NU")] + public string PourNu { get; set; } /// - /// 实际注料料比 + /// 枪设定注料时间 /// - [SugarColumn(ColumnName = "ACTUALINJECTIONMATERIALRATIO")] - public string ActualInjectionMaterialRatio { get; set; } + [SugarColumn(ColumnName = "SET_TIME")] + public string SetTime { get; set; } /// - /// 枪头POL注料压力 + /// 枪设定注料重量 /// - [SugarColumn(ColumnName = "INJECPRESSUREOFPOLGUNHEAD")] - public string InjecPressureOfPOLGunHead { get; set; } + [SugarColumn(ColumnName = "SET_WEIGHT")] + public string SetWeight { get; set; } /// - /// 枪头ISO注料压力 + /// 枪设定注料比例 /// - [SugarColumn(ColumnName = "INJECPRESSUREOFISOGUNHEAD")] - public string InjecPressureOfISOGunHead { get; set; } + [SugarColumn(ColumnName = "SET_RATIO")] + public string SetRatio { get; set; } /// - /// 枪头POL注料温度 + /// 枪实际注料重量 /// - [SugarColumn(ColumnName = "POLINJECTEMPERATUREOFGUNHEAD")] - public string POLInjecTemperatureOfGunHead { get; set; } + [SugarColumn(ColumnName = "POUR_WEIGHT")] + public string PourWeight { get; set; } /// - /// 枪头ISO注料温度 + /// 枪实际注料比例 /// - [SugarColumn(ColumnName = "ISOINJECTEMPERATUREOFGUNHEAD")] - public string ISOInjecTemperatureOfGunHead { get; set; } + [SugarColumn(ColumnName = "POUR_RATIO")] + public string PourRatio { get; set; } /// - /// POL注料流量 + /// 枪中压循环时间 /// - [SugarColumn(ColumnName = "POLINJECFLOWRATE")] - public string POLInjecFlowRate { get; set; } + [SugarColumn(ColumnName = "MP_TIME")] + public string MpTime { get; set; } /// - /// ISO注料流量 + /// 枪高压循环时间 /// - [SugarColumn(ColumnName = "ISOINJECFLOWRATE")] - public string ISOInjecFlowRate { get; set; } + [SugarColumn(ColumnName = "HP_TIME")] + public string HpTime { get; set; } /// - /// 液压压力 + /// 枪液压压力 /// - [SugarColumn(ColumnName = "HYDRAULICPRESSURE")] - public string HydraulicPressure { get; set; } + [SugarColumn(ColumnName = "HYDR_PRESS")] + public string HydrPress { get; set; } /// - /// 液压温度 + /// 枪液压温度 /// - [SugarColumn(ColumnName = "HYDRAULICTEMPERATURE")] - public string HydraulicTemperature { get; set; } + [SugarColumn(ColumnName = "HYDR_TEMP")] + public string HydrTemp { get; set; } /// - /// 小活塞开枪时间 + /// 枪开枪时间 /// - [SugarColumn(ColumnName = "SMALLPISTONFIRINGTIME")] - public string SmallPistonFiringTime { get; set; } + [SugarColumn(ColumnName = "MIXPIST_ON")] + public string MixpistOn { get; set; } /// - /// 小活塞关枪时间 + /// 枪关枪时间 /// - [SugarColumn(ColumnName = "SMALLPISTONGUNSHUTDOWNTIME")] - public string SmallPistonGunShutdownTime { get; set; } - + [SugarColumn(ColumnName = "MIXPIST_OFF")] + public string MixpistOff { get; set; } /// - /// 注料状态 + /// 枪总产量 /// - [SugarColumn(ColumnName = "INJECTIONSTATUS")] - public string InjectionStatus { get; set; } + [SugarColumn(ColumnName = "TOTAL_YIELD")] + public string TotalYield { get; set; } + /// - /// 最后一次时间 + /// 枪注料结束信号 /// - [SugarColumn(ColumnName = "LAST_TIME")] - public DateTime LastTime { get; set; } + [SugarColumn(ColumnName = "POUR_END")] + public string PourEnd { get; set; } + /// /// 创建时间 /// - [SugarColumn(ColumnName = "CREATETIME")] - public DateTime Createtime { get; set; } - /// - /// 产线 - /// - [SugarColumn(ColumnName = "PRODUCT_LINE_CODE")] - public string ProductLineCode { get; set; } - + [SugarColumn(ColumnName = "CREATE_TIME")] + public DateTime CreateTime { get; set; } } } diff --git a/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs b/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs index 0748dc5e..a86a753d 100644 --- a/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs +++ b/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs @@ -66,45 +66,44 @@ namespace Admin.Core.Tasks if (obj != null && obj.plc.IsConnected) { BoxLastShotRecord lastShotRecord = new BoxLastShotRecord(); - byte[] info = obj.plc.ReadBytes("DB50.900", (ushort)87); + byte[] info = obj.plc.ReadBytes("DB50.896", (ushort)88); IByteTransform byteTransform = new RegularByteTransform(); - lastShotRecord.System = "1"; - lastShotRecord.BoxFixtureType = "test"; - lastShotRecord.GunHead = Encoding.ASCII.GetString(info.Skip(0).Take(4).ToArray()); - lastShotRecord.StationNumber = StringChange.bytesToHexStr(info.Skip(4).Take(2).ToArray(), 2); - lastShotRecord.MediumPressureCycleTime = StringChange.bytesToHexStr(info.Skip(6).Take(4).ToArray(), 4); - lastShotRecord.HighPressureCycleTime = StringChange.bytesToHexStr(info.Skip(10).Take(4).ToArray(), 4); - lastShotRecord.SetInjectionWeight = StringChange.bytesToHexStr(info.Skip(14).Take(4).ToArray(), 4); - lastShotRecord.InjectionMaterialRatio = StringChange.bytesToHexStr(info.Skip(18).Take(4).ToArray(), 4); - lastShotRecord.ActualInjectionWeight = StringChange.bytesToHexStr(info.Skip(22).Take(4).ToArray(), 4); - lastShotRecord.ActualInjectionMaterialRatio = StringChange.bytesToHexStr(info.Skip(26).Take(4).ToArray(), 4); - lastShotRecord.PolInjectionpressure = StringChange.bytesToHexStr(info.Skip(30).Take(4).ToArray(), 4); - lastShotRecord.IsoInjectionpressure = StringChange.bytesToHexStr(info.Skip(34).Take(4).ToArray(), 4); - lastShotRecord.PolInjectiontemperature = StringChange.bytesToHexStr(info.Skip(38).Take(4).ToArray(), 4); - lastShotRecord.IsoInjectiontemperature = StringChange.bytesToHexStr(info.Skip(42).Take(4).ToArray(), 4); - lastShotRecord.InjecPressureOfPOLGunHead = StringChange.bytesToHexStr(info.Skip(46).Take(4).ToArray(), 4); - lastShotRecord.InjecPressureOfISOGunHead = StringChange.bytesToHexStr(info.Skip(50).Take(4).ToArray(), 4); - lastShotRecord.POLInjecTemperatureOfGunHead = StringChange.bytesToHexStr(info.Skip(54).Take(4).ToArray(), 4); - lastShotRecord.ISOInjecTemperatureOfGunHead = StringChange.bytesToHexStr(info.Skip(58).Take(4).ToArray(), 4); + lastShotRecord.System = "1"; + lastShotRecord.GunCode = "A1"; + lastShotRecord.GunCode = "A1"; + #region 赋值 + lastShotRecord.PolTemp = Encoding.ASCII.GetString(info.Skip(0).Take(4).ToArray()); + lastShotRecord.PolHp = StringChange.bytesToHexStr(info.Skip(4).Take(4).ToArray(), 4); + lastShotRecord.PolVol = StringChange.bytesToHexStr(info.Skip(8).Take(4).ToArray(), 4); + lastShotRecord.PolUsage = StringChange.bytesToHexStr(info.Skip(12).Take(4).ToArray(), 4); + lastShotRecord.IsoTemp = StringChange.bytesToHexStr(info.Skip(16).Take(4).ToArray(), 4); + lastShotRecord.IsoHp = StringChange.bytesToHexStr(info.Skip(20).Take(4).ToArray(), 4); + lastShotRecord.IsoVol = StringChange.bytesToHexStr(info.Skip(24).Take(4).ToArray(), 4); + lastShotRecord.IsoUsage = StringChange.bytesToHexStr(info.Skip(28).Take(4).ToArray(), 4); + lastShotRecord.PourNu = StringChange.bytesToHexStr(info.Skip(36).Take(2).ToArray(), 2); + lastShotRecord.SetTime = StringChange.bytesToHexStr(info.Skip(38).Take(4).ToArray(), 4); + lastShotRecord.SetWeight = StringChange.bytesToHexStr(info.Skip(42).Take(4).ToArray(), 4); + lastShotRecord.SetRatio = StringChange.bytesToHexStr(info.Skip(46).Take(4).ToArray(), 4); + lastShotRecord.PourWeight = StringChange.bytesToHexStr(info.Skip(50).Take(4).ToArray(), 4); + lastShotRecord.PourRatio = StringChange.bytesToHexStr(info.Skip(54).Take(4).ToArray(), 4); + lastShotRecord.MpTime = StringChange.bytesToHexStr(info.Skip(58).Take(4).ToArray(), 4); + lastShotRecord.HpTime = StringChange.bytesToHexStr(info.Skip(62).Take(4).ToArray(), 4); + lastShotRecord.HydrPress = StringChange.bytesToHexStr(info.Skip(66).Take(4).ToArray(), 4); + lastShotRecord.HydrTemp = StringChange.bytesToHexStr(info.Skip(70).Take(4).ToArray(), 4); + lastShotRecord.MixpistOn = StringChange.bytesToHexStr(info.Skip(74).Take(4).ToArray(), 4); + lastShotRecord.MixpistOff = StringChange.bytesToHexStr(info.Skip(78).Take(4).ToArray(), 4); + lastShotRecord.TotalYield = StringChange.bytesToHexStr(info.Skip(82).Take(4).ToArray(), 4); + lastShotRecord.PourEnd = StringChange.bytesToHexStr(info.Skip(87).Take(4).ToArray(), 4); + lastShotRecord.CreateTime = DateTime.Now; + #endregion - lastShotRecord.POLInjecFlowRate = StringChange.bytesToHexStr(info.Skip(62).Take(4).ToArray(), 4); - lastShotRecord.ISOInjecFlowRate = StringChange.bytesToHexStr(info.Skip(66).Take(4).ToArray(), 4); - lastShotRecord.HydraulicPressure = StringChange.bytesToHexStr(info.Skip(70).Take(4).ToArray(), 4); - lastShotRecord.HydraulicTemperature = StringChange.bytesToHexStr(info.Skip(74).Take(4).ToArray(), 4); - lastShotRecord.SmallPistonFiringTime = StringChange.bytesToHexStr(info.Skip(78).Take(4).ToArray(), 4); - lastShotRecord.SmallPistonGunShutdownTime = StringChange.bytesToHexStr(info.Skip(82).Take(4).ToArray(), 4); - lastShotRecord.InjectionStatus = StringChange.bytesToHexStr(info.Skip(86).Take(1).ToArray(), 1); - lastShotRecord.LastTime = DateTime.Now; - lastShotRecord.Createtime = DateTime.Now; - lastShotRecord.ProductLineCode = "111"; - if (tempLastRecord == null) { //数据库查 - tempLastRecord = _lastShotRecordServices.Query(x=>x.System == lastShotRecord.System).OrderByDescending(x=>x.Createtime).FirstOrDefault(); + tempLastRecord = _lastShotRecordServices.Query(x=>x.System == lastShotRecord.System && x.ProductLineCode==lastShotRecord.ProductLineCode && x.GunCode==lastShotRecord.GunCode).OrderByDescending(x=>x.CreateTime).FirstOrDefault(); } - if (!tempLastRecord.SmallPistonGunShutdownTime.Equals(lastShotRecord.SmallPistonGunShutdownTime)) + if (!tempLastRecord.MixpistOff.Equals(lastShotRecord.MixpistOff)) { // 刷新页面 RefreshLastShotDataDelegateEvent?.Invoke(lastShotRecord); diff --git a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs index 1c9a7876..c2ac9752 100644 --- a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs +++ b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs @@ -122,9 +122,9 @@ namespace Aucma.Core.BoxFoam.Business // test(); // 获取任务下发plc StartPassDown(); - InStore("B23600083025024860011"); + InStore("B23600083025024860011"); }); - // startTimer(); + startTimer(); } public async void test() diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs index 77aeeb1d..3975d0fd 100644 --- a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs @@ -36,10 +36,10 @@ namespace Aucma.Core.BoxFoam.ViewModels if (record.System == "1") { system = "1系统"; - PolFlow1 = record.POLInjecFlowRate; - IsoFlow1 = record.ISOInjecFlowRate; - PoleTmperature1 = record.POLInjecTemperatureOfGunHead; - IsoTemperature1 = record.ISOInjecTemperatureOfGunHead; + // PolFlow1 = record.POLInjecFlowRate; + // IsoFlow1 = record.ISOInjecFlowRate; + // PoleTmperature1 = record.POLInjecTemperatureOfGunHead; + // IsoTemperature1 = record.ISOInjecTemperatureOfGunHead; } if (record.System == "2") { system = "2系统"; } @@ -47,14 +47,14 @@ namespace Aucma.Core.BoxFoam.ViewModels { No = LastShotRecordDataGrid.Count+1, System = system, - GunHead = record.GunHead, - StationNumber = record.StationNumber, - PolInjectionpressure = record.PolInjectionpressure, - IsoInjectionpressure = record.IsoInjectionpressure, - PolInjectiontemperature = record.PolInjectiontemperature, - IsoInjectiontemperature = record.IsoInjectiontemperature, - LastTime = record.LastTime, - Createtime = record.Createtime + GunHead = record.GunCode, + // StationNumber = record.StationNumber, + PolInjectionpressure = record.PolHp, + IsoInjectionpressure = record.IsoHp, + PolInjectiontemperature = record.PolTemp, + IsoInjectiontemperature = record.IsoTemp, + LastTime = record.CreateTime, + Createtime = record.CreateTime }); })); @@ -74,7 +74,7 @@ namespace Aucma.Core.BoxFoam.ViewModels int i = 1; var list = await _boxLastShotRecordServices.QueryAsync(); if (list == null) return; - list.OrderByDescending(d => d.LastTime); + list.OrderByDescending(d => d.CreateTime); foreach (var item in list.Take(50)) { string system = string.Empty; @@ -84,14 +84,14 @@ namespace Aucma.Core.BoxFoam.ViewModels { No = i, System = system, - GunHead=item.GunHead, - StationNumber=item.StationNumber, - PolInjectionpressure = item.PolInjectionpressure, - IsoInjectionpressure = item.IsoInjectionpressure, - PolInjectiontemperature = item.PolInjectiontemperature, - IsoInjectiontemperature = item.IsoInjectiontemperature, - LastTime = item.LastTime, - Createtime = item.Createtime + GunHead=item.GunCode, + // StationNumber=item.StationNumber, + PolInjectionpressure = item.PolHp, + IsoInjectionpressure = item.IsoHp, + PolInjectiontemperature = item.PolTemp, + IsoInjectiontemperature = item.IsoTemp, + LastTime = item.CreateTime, + Createtime = item.CreateTime }); i++; }; diff --git a/Aucma.Core.ProductOffLine/appsettings.json b/Aucma.Core.ProductOffLine/appsettings.json index e59015e5..f826cdce 100644 --- a/Aucma.Core.ProductOffLine/appsettings.json +++ b/Aucma.Core.ProductOffLine/appsettings.json @@ -82,7 +82,7 @@ "Enabled": true, "HitRate": 50, //"Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_scada;Password=aucma;", + "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=C##aucma_scada;Password=aucma;", "ProviderName": "System.Data.SqlClient" }, { @@ -90,7 +90,7 @@ "DBType": 3, "Enabled": true, "HitRate": 40, - "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_mes;Password=aucma;", + "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=c##aucma_mes;Password=aucma;", "ProviderName": "System.Data.SqlClient" }, {