diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 49000baf..acbe2cea 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -1246,11 +1246,26 @@ 夹具序号 + + + 公司 + + 产线编码 + + + 工序 + + + + + 工位 + + 夹具箱型 @@ -1436,6 +1451,96 @@ 更新时间 + + + 夹具历史数据 + + + + + 主键 + + + + + 公司 + + + + + 产线编码 + + + + + 工序 + + + + + 工位 + + + + + 夹具箱型 + + + + + 夹具状态 + + + + + 夹具产量 + + + + + 夹具固化时间设定值 + + + + + 夹具固化时间显示值 + + + + + 模具内温度 + + + + + 模具外温度 + + + + + 节拍 + + + + + 创建人 + + + + + 创建时间 + + + + + 更新人 + + + + + 更新时间 + + 发泡计划 diff --git a/Admin.Core.IRepository/IRepository_New/IBoxFoamDataRealTimeHistoryRepository.cs b/Admin.Core.IRepository/IRepository_New/IBoxFoamDataRealTimeHistoryRepository.cs new file mode 100644 index 00000000..95baf6f4 --- /dev/null +++ b/Admin.Core.IRepository/IRepository_New/IBoxFoamDataRealTimeHistoryRepository.cs @@ -0,0 +1,12 @@ +using Admin.Core.Model; +using Admin.Core.Model.Model_New; + +namespace Admin.Core.IRepository +{ + /// + /// IBoxFoamDataRealTimeHistoryRepository + /// + public interface IBoxFoamDataRealTimeHistoryRepository : IBaseRepository + { + } +} \ No newline at end of file diff --git a/Admin.Core.IService/IService_New/IBoxFoamDataRealTimeHistoryServices.cs b/Admin.Core.IService/IService_New/IBoxFoamDataRealTimeHistoryServices.cs new file mode 100644 index 00000000..6b8a93b7 --- /dev/null +++ b/Admin.Core.IService/IService_New/IBoxFoamDataRealTimeHistoryServices.cs @@ -0,0 +1,15 @@ +using Admin.Core.IService; +using Admin.Core.Model; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IService +{ + /// + /// IBoxFoamDataRealTimeHistoryServices + /// + public interface IBoxFoamDataRealTimeHistoryServices : IBaseServices + { + + } +} \ No newline at end of file diff --git a/Admin.Core.Model/Model_New/BoxFoamDataRealTime.cs b/Admin.Core.Model/Model_New/BoxFoamDataRealTime.cs index 9d486dd6..3486c19b 100644 --- a/Admin.Core.Model/Model_New/BoxFoamDataRealTime.cs +++ b/Admin.Core.Model/Model_New/BoxFoamDataRealTime.cs @@ -23,12 +23,27 @@ namespace Admin.Core.Model /// [SugarColumn(ColumnName = "SERIALNUMBER")] public int SerialNumber { get; set; } + /// + /// 公司 + /// + [SugarColumn(ColumnName = "PLANT_CODE")] + public string PlantCode { get; set; } + /// /// 产线编码 /// [SugarColumn(ColumnName = "PRODUCTLINE_CODE")] public string ProductlineCode { get; set; } - + /// + /// 工序 + /// + [SugarColumn(ColumnName = "PROCESS_CODE")] + public string ProcessCode { get; set; } + /// + /// 工位 + /// + [SugarColumn(ColumnName = "STATION_CODE")] + public string StationCode { get; set; } /// /// 夹具箱型 /// diff --git a/Admin.Core.Model/Model_New/BoxFoamDdataRealTimeHistory.cs b/Admin.Core.Model/Model_New/BoxFoamDdataRealTimeHistory.cs new file mode 100644 index 00000000..6adf0d1a --- /dev/null +++ b/Admin.Core.Model/Model_New/BoxFoamDdataRealTimeHistory.cs @@ -0,0 +1,115 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model +{ + /// + /// 夹具历史数据 + /// + [SugarTable("BOX_FOAMDATAREALTIME_HISTORY", "AUCMA_SCADA")] + public class BoxFoamDataRealTimeHistory + { + /// + /// 主键 + /// + [SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)] + public int ObjId { get; set; } + + /// + /// 公司 + /// + [SugarColumn(ColumnName = "PLANT_CODE")] + public string PlantCode { get; set; } + + /// + /// 产线编码 + /// + [SugarColumn(ColumnName = "PRODUCTLINE_CODE")] + public string ProductlineCode { get; set; } + /// + /// 工序 + /// + [SugarColumn(ColumnName = "PROCESS_CODE")] + public string ProcessCode { get; set; } + /// + /// 工位 + /// + [SugarColumn(ColumnName = "STATION_CODE")] + public string StationCode { get; set; } + /// + /// 夹具箱型 + /// + [SugarColumn(ColumnName = "FIXTURE_BOXTYPE")] + public string FixtureBoxtype { get; set; } + + /// + /// 夹具状态 + /// + [SugarColumn(ColumnName = "FIXTURE_STATUS")] + public string FixtureStatus { get; set; } + + /// + /// 夹具产量 + /// + [SugarColumn(ColumnName = "FIXTURE_PRODUCTIONCAPACITY")] + public float FixtureProductioncapacity { get; set; } + + /// + /// 夹具固化时间设定值 + /// + [SugarColumn(ColumnName = "FIXTURE_CURINGTIMESETTINGVALUE")] + public string FixtureCuringtimesettingvalue { get; set; } + + /// + /// 夹具固化时间显示值 + /// + [SugarColumn(ColumnName = "FIXTURE_ACTUALTIME")] + public string FixtureActualtime { get; set; } + + /// + /// 模具内温度 + /// + [SugarColumn(ColumnName = "MODE_INTERNALTEMPERATURE")] + public string ModeInternaltemperature { get; set; } + + /// + /// 模具外温度 + /// + [SugarColumn(ColumnName = "MODE_OUTSIDETEMPERATURE")] + public string ModeOutsidetemperature { get; set; } + + /// + /// 节拍 + /// + [SugarColumn(ColumnName = "BEAT")] + public string Beat { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime CreatedTime { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime UpdatedTime { get; set; } + } +} diff --git a/Admin.Core.Repository/Repository_New/BoxFoamDataRealTimeHistoryRepository.cs b/Admin.Core.Repository/Repository_New/BoxFoamDataRealTimeHistoryRepository.cs new file mode 100644 index 00000000..14291e79 --- /dev/null +++ b/Admin.Core.Repository/Repository_New/BoxFoamDataRealTimeHistoryRepository.cs @@ -0,0 +1,15 @@ +using Admin.Core.IRepository; +using Admin.Core.Model; + +namespace Admin.Core.Repository +{ + /// + /// OrderBomInfoRepository + /// + public class BoxFoamDataRealTimeHistoryRepository : BaseRepository, IBoxFoamDataRealTimeHistoryRepository + { + public BoxFoamDataRealTimeHistoryRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + } +} \ No newline at end of file diff --git a/Admin.Core.Service/Service_New/BoxFoamDataRealTimeHistoryServices.cs b/Admin.Core.Service/Service_New/BoxFoamDataRealTimeHistoryServices.cs new file mode 100644 index 00000000..22bf77cd --- /dev/null +++ b/Admin.Core.Service/Service_New/BoxFoamDataRealTimeHistoryServices.cs @@ -0,0 +1,26 @@ +using Admin.Core.IRepository; +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using log4net; +using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.IdentityModel.Logging; +using NPOI.SS.Formula.Functions; +using NPOI.XSSF.UserModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Admin.Core.Service +{ + public class BoxFoamDataRealTimeHistoryServices : BaseServices, IBoxFoamDataRealTimeHistoryServices + { + private readonly IBaseRepository _dal; + public BoxFoamDataRealTimeHistoryServices(IBaseRepository dal) + { + this._dal = dal; + } + + } +} \ No newline at end of file diff --git a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs index 6ee25639..1dc14cce 100644 --- a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs +++ b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs @@ -2,7 +2,6 @@ using Admin.Core.IService; using Admin.Core.Model; using Aucma.Core.HwPLc; -using HwCommunication.Core; using NetTaste; using NPOI.Util; using System; diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs index 9eeb29b6..1d198594 100644 --- a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs @@ -23,6 +23,8 @@ using Admin.Core.Model.Model_New; using Admin.Core.Model.ViewModels; using System.Threading; using Aucma.Core.HwPLc; +using Castle.Core.Internal; +using Admin.Core.Repository; namespace Aucma.Core.BoxFoam.ViewModels { @@ -35,6 +37,8 @@ namespace Aucma.Core.BoxFoam.ViewModels private readonly ISysUserInfoServices _sysUserInfoServices; private readonly IBoxFoamDataRecordServices _boxFoamDataRecordServices; private readonly IBoxFoamDataRealTimeServices? _boxFoamDataRealTimeServices; + + private readonly IBoxFoamDataRealTimeHistoryServices _boxFoamDataRealTimeHistoryServices; System.Timers.Timer timer2 = new System.Timers.Timer(2000); int totalAmount = 0; @@ -45,7 +49,8 @@ namespace Aucma.Core.BoxFoam.ViewModels _boxFoamDataRealTimeServices = App.ServiceProvider.GetService(); _boxFoamDataRecordServices = App.ServiceProvider.GetService(); _currentTeamTimeServices = App.ServiceProvider.GetService(); - // _boxFoamDataServices = App.ServiceProvider.GetService(); + _boxFoamDataRealTimeHistoryServices = App.ServiceProvider.GetService(); + // _boxFoamDataServices = App.ServiceProvider.GetService(); CollectionFoamLine.RefreshBoxFoamDataDelegateEvent += InitData; timer2.Elapsed += new System.Timers.ElapsedEventHandler(RealTimeFoamingTask); //到达时间的时候执行事件; @@ -299,12 +304,11 @@ namespace Aucma.Core.BoxFoam.ViewModels { if (item.Status == 1) StatusColor.Add("Green"); if (item.Status == 0) StatusColor.Add("Red"); - - FixtureName.Add(item.FixtureBoxType); - Production.Add(item.Yield.ToString()); - InternalTemperature.Add(item.InternalTemperature.ToString()); - OutsideTemperature.Add(item.OutsideTemperature.ToString()); - Beat.Add(item.ProductionCycle); + if (!string.IsNullOrEmpty(item.FixtureBoxType)) FixtureName.Add(item.FixtureBoxType); + if (!string.IsNullOrEmpty(item.Yield.ToString())) Production.Add(item.Yield.ToString()); + if (!string.IsNullOrEmpty(item.InternalTemperature.ToString())) InternalTemperature.Add(item.InternalTemperature.ToString()); + if (!string.IsNullOrEmpty(item.OutsideTemperature.ToString())) OutsideTemperature.Add(item.OutsideTemperature.ToString()); + if (!string.IsNullOrEmpty(item.ProductionCycle.ToString())) Beat.Add(item.ProductionCycle); totalAmount = totalAmount + item.Yield; } @@ -380,7 +384,24 @@ namespace Aucma.Core.BoxFoam.ViewModels SaveClampData(productLineCode, fixtureStatus); } plan.CompleteAmount = plan.CompleteAmount + complateAmount; - await _boxFoamPlanServices.UpdateAsync(plan); + if (complateAmount>0) + { + BoxFoamDataRealTimeHistory history = new BoxFoamDataRealTimeHistory(); + + history.PlantCode = bfd.PlantCode; + history.ProductlineCode = bfd.ProductlineCode; + history.ProcessCode = bfd.ProcessCode; + history.StationCode= bfd.StationCode; + history.FixtureProductioncapacity = bLis[j].Yield; + history.FixtureCuringtimesettingvalue = bLis[j].PlanCuringTime.ToString(); + history.FixtureActualtime = bLis[j].RealCuringTime.ToString(); + history.ModeInternaltemperature = bLis[j].InternalTemperature; + history.ModeOutsidetemperature = bLis[j].InternalTemperature; + history.UpdatedTime = DateTime.Now; + + await _boxFoamDataRealTimeHistoryServices.AddAsync(history); + await _boxFoamPlanServices.UpdateAsync(plan); + } } else { @@ -403,16 +424,14 @@ namespace Aucma.Core.BoxFoam.ViewModels private async void ShiftChangeAsync(string productLineCode) { //切换班组计划 - //var currentTeamTimeList = await _sysUserInfoServices.GetTeamData(); - //if (currentTeamTimeList.Count == 0) return; - //var list= await _boxFoamDataRealTimeServices.QueryAsync(d => d.ProductlineCode == productLineCode); - ////更新计划表操作 - //CurrentTeamTime currentTeamTime = await _currentTeamTimeServices.FirstAsync(); - //currentTeamTime.TeamName = currentTeamTimeList.FirstOrDefault().TeamName; - //currentTeamTime.StartTime = currentTeamTimeList.Min(d => d.StartTime); - //currentTeamTime.EndTime = currentTeamTimeList.Max(d => d.EndTime); - - + var currentTeamTimeList = await _sysUserInfoServices.GetTeamData(); + if (currentTeamTimeList.Count == 0) return; + var list = await _boxFoamDataRealTimeServices.QueryAsync(d => d.ProductlineCode == productLineCode); + //更新计划表操作 + CurrentTeamTime currentTeamTime = await _currentTeamTimeServices.FirstAsync(); + currentTeamTime.TeamName = currentTeamTimeList.FirstOrDefault().TeamName; + currentTeamTime.StartTime = currentTeamTimeList.Min(d => d.StartTime); + currentTeamTime.EndTime = currentTeamTimeList.Max(d => d.EndTime); //可以使用Mapping 映射 @@ -442,7 +461,7 @@ namespace Aucma.Core.BoxFoam.ViewModels // record.CreateTime = DateTime.Now; //}); - + //int result = await _boxFoamDataRecordServices.AddAsync(recordList); //if (result > 0) //{ @@ -452,6 +471,7 @@ namespace Aucma.Core.BoxFoam.ViewModels // //清空 当班计划 // await _oldBoxFoamDataServices.DeletesAsync(list); // await _currentTeamTimeServices.UpdateAsync(currentTeamTime); + //} }